protected void BtnExportReport_Click(object sender, EventArgs e)
{
//if (DdlBrandList.SelectedIndex <= 0)
//{
// MessageTitle = "Select Brand";
// MessageSwalTitle = "Oops !!!";
// MessageSwalDisplay = MessageTitle;
// MessageSwalType = "warning"; // info , success , warning , error
// ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
// return;
//}
int count = LstBoxBranchList.GetSelectedIndices().Length;
if (count == 0)
{
MessageTitle = "Select Location";
MessageSwalTitle = "Oops !!!";
MessageSwalDisplay = MessageTitle;
MessageSwalType = "warning"; // info , success , warning , error
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
return;
}
if (TxtDateFrom.Text == "")
{
MessageTitle = "Select Date From";
MessageSwalTitle = "Oops !!!";
MessageSwalDisplay = MessageTitle;
MessageSwalType = "warning"; // info , success , warning , error
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
return;
}
if (TxtDateTo.Text == "")
{
MessageTitle = "Select Date To";
MessageSwalTitle = "Oops !!!";
MessageSwalDisplay = MessageTitle;
MessageSwalType = "warning"; // info , success , warning , error
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
return;
}
//TxtDateFrom.Text = DateTime.Now.ToString("MM/dd/yyyy");
//TxtDateTo.Text = DateTime.Now.ToString("MM/dd/yyyy");
DateTime DateTimeStart = DateTime.ParseExact(TxtDateFrom.Text, "MM/dd/yyyy", null); // textbox show be read only =false
DateTimeStart = Convert.ToDateTime(DateTimeStart, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
//"hi-IN" is culture information about India. You can change as per culture like French, German, etc.
DateTime DateTimeEnd = DateTime.ParseExact(TxtDateTo.Text, "MM/dd/yyyy", null); // textbox show be read only =false
DateTimeEnd = Convert.ToDateTime(DateTimeEnd, System.Globalization.CultureInfo.GetCultureInfo("hi-IN").DateTimeFormat);
//"hi-IN" is culture information about India. You can change as per culture like French, German, etc.
if (DateTimeEnd < DateTimeStart)
{
MessageTitle = "Invalid Date ";
MessageSwalTitle = "Oops !!!";
MessageSwalDisplay = MessageTitle;
MessageSwalType = "warning"; // info , success , warning , error
ScriptManager.RegisterStartupScript(this, this.GetType(), "Script", "FunctionAlertMessage('" + MessageSwalTitle + "', '" + MessageSwalDisplay + "', '" + MessageSwalType + "');", true);
return;
}
ExportReportCollectionRegister();
}
// End Btn Export