protected void btnsendLink_Click(object sender, EventArgs e) { string Message = string.Empty; Message = "Welcome to Pune PWD DBS Software\n"; Message += "Click here to download DBS App:- \n"; Message += " http://pwdpune.sghitech.co.in/AndroidApplication/DBS.apk"; objSendSMS.SendSMS(Message, txtMobileNo.Text.Trim(), "", ""); }
/// <summary> /// Sending Scheduler email to user using Quartz.Net /// </summary> /// <param name="recepientEmail"> /// <param name="subject"> /// <param name="body"> public void RenDateMsg() { MyAssociation k = new MyAssociation(); string curdate = DateTime.Now.ToString("MMM dd yyyy"); ArrayList objAL_Month = new ArrayList(); ArrayList objAL_Day15 = new ArrayList(); ArrayList objAL_Day7 = new ArrayList(); ArrayList objAL_Day3 = new ArrayList(); ArrayList objAL_Day1 = new ArrayList(); ArrayList objAL_today = new ArrayList(); con.Open(); SqlCommand cmd = new SqlCommand("Select SmsId,WorkId,ShakhaAbhyantaName, ShakhaAbhiyantMobile, UpabhyantaName, UpAbhiyantaMobile, KamacheName, ThekedaarName, ThekedarMobile,convert(date,KamPurnDate,105) as KamPurnDate,MudatVadDate,Message,BeforMonth,Befor_15Days,Befor_7Days,Befor_3Days,Befor_1Day,SameDays from SendSms_tbl where convert(date,KamPurnDate,105) between CONVERT(date,GETDATE(),105) and convert(date,dateadd(day,31,GETDATE()),105)", con); cmd.Parameters.AddWithValue("@date", curdate); try { SqlDataReader reader1 = cmd.ExecuteReader(); if (reader1 != null) { while (reader1.Read()) { string Message = string.Empty; string UId = reader1["SmsId"].ToString(); string WorkId = reader1["WorkId"].ToString(); string ShakhaAbhyantaName = reader1["ShakhaAbhyantaName"].ToString(); string ShakhaAbhyantMobile = reader1["ShakhaAbhiyantMobile"].ToString(); string UpabhyantaName = reader1["UpabhyantaName"].ToString(); string UpbhyantaMobile = reader1["UpAbhiyantaMobile"].ToString(); string KamacheName = reader1["KamacheName"].ToString(); string ThekedaarName = reader1["ThekedaarName"].ToString(); string ThekedaarMobile = reader1["ThekedarMobile"].ToString(); string KamPurnDate1 = reader1["KamPurnDate"].ToString(); string MudatVadDate = reader1["MudatVadDate"].ToString(); string KamPurnDate = string.Empty; Message = "Welcome to Division Budget Software\r\n"; Message += "P.W.(East) Division Pune\r\n"; Message += "Work Id: " + WorkId + "\r\n"; Message += "Stipulated Date of completion: " + KamPurnDate1 + "\r\n"; int BeforMonth = Convert.ToInt16(reader1["BeforMonth"]); int Befor_15Days = Convert.ToInt16(reader1["Befor_15Days"]); int Befor_7Days = Convert.ToInt16(reader1["Befor_7Days"]); int Befor_3Days = Convert.ToInt16(reader1["Befor_3Days"]); int Befor_1Day = Convert.ToInt16(reader1["Befor_1Day"]); int SameDays = Convert.ToInt16(reader1["SameDays"]); //DateTime dt = DateTime.ParseExact(date, "MM/dd/yyyy", CultureInfo.InvariantCulture); //For Currant Date if (KamPurnDate1 == "" || KamPurnDate1 == "0" || KamPurnDate1 == null) { } else { string oldstr = reader1["KamPurnDate"].ToString(); // KamPurnDate = DateTime.ParseExact(oldstr, "dd/MM/yyyy", null).ToString("MM/dd/yyyy"); DateTime dtsame = Convert.ToDateTime(oldstr); string dtsame1 = dtsame.ToString("MMM dd yyy"); // DateTime dtSameDay = Convert.ToDateTime(date); //For Before 1 Month DateTime dt = Convert.ToDateTime(oldstr); dt = dt.AddMonths(-1); string dtMonth = dt.ToString("MMM dd yyyy"); //For Before 15 Day DateTime dt1 = Convert.ToDateTime(oldstr); dt1 = dt1.AddDays(-15); string dtDay15 = dt1.ToString("MMM dd yyyy"); //For Before 7 Day DateTime dt2 = Convert.ToDateTime(oldstr); dt2 = dt2.AddDays(-7); string dtDay7 = dt2.ToString("MMM dd yyyy"); //For Before 3 Day DateTime dt3 = Convert.ToDateTime(oldstr); dt3 = dt3.AddDays(-3); string dtDay3 = dt3.ToString("MMM dd yyyy"); //For Before 1 Day DateTime dt4 = Convert.ToDateTime(oldstr); dt4 = dt4.AddDays(-1); string dtDay1 = dt4.ToString("MMM dd yyyy"); //For Sending Message One Month Before if (dtMonth == curdate && BeforMonth == 0) { Message += "Remaining Days: 30 Days\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_Month.Add(UId); } //For Sending Message Before 15 Days else if (curdate == dtDay15 && Befor_15Days == 0) { Message += "Remaining Days: 15 Days\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_Day15.Add(UId); } //For Sending Message Before 7 day else if (curdate == dtDay7 && Befor_7Days == 0) { Message += "Remaining Days: 07 Days\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_Day7.Add(UId); } //For Sending Message Before 3 day else if (curdate == dtDay3 && Befor_3Days == 0) { Message += "Remaining Days: 03 Days\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_Day3.Add(UId); } // For Sending Message Before 1 Day else if (curdate == dtDay1 && Befor_1Day == 0) { Message += "Remaining Days: 1 Day\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_Day1.Add(UId); } //For Sending Message On Currante date else if (curdate == dtsame1 && SameDays == 0) { Message += "Today is: Last date\r\n"; Message += "Please submit Extension proposal\r\n"; Message += "WebSite Url: http://www.pwdpune.sghitech.co.in"; k.SendSMS(Message, ThekedaarMobile, UpbhyantaMobile, ShakhaAbhyantMobile); objAL_today.Add(UId); } } } reader1.Close(); foreach (string usrid in objAL_Month) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set BeforMonth=@mon where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@mon", 1); upcmd.ExecuteNonQuery(); } foreach (string usrid in objAL_Day15) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set Befor_15Days=@hm where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@hm", 1); upcmd.ExecuteNonQuery(); } foreach (string usrid in objAL_Day7) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set Befor_7Days=@weak where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@weak", 1); upcmd.ExecuteNonQuery(); } foreach (string usrid in objAL_Day3) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set Befor_3Days=@threeday where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@threeday", 1); upcmd.ExecuteNonQuery(); } foreach (string usrid in objAL_Day1) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set Befor_1Day=@oneday where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@oneday", 1); upcmd.ExecuteNonQuery(); } foreach (string usrid in objAL_today) { string userid = usrid; SqlCommand upcmd = new SqlCommand("update [SendSms_tbl] set SameDays=@today where SmsId = '" + userid + "'", con); upcmd.Parameters.AddWithValue("@today", 1); upcmd.ExecuteNonQuery(); } } } catch (Exception) { throw; } con.Close(); }
protected void BtnSav_Click(object sender, EventArgs e) { string[] NameOrMobileNo = txtName.Text.Split(new[] { ':' }, 2); string[] NameOrMobile = new string[2]; if (NameOrMobileNo.Length > 1) { NameOrMobile = NameOrMobileNo; } else { NameOrMobile[0] = NameOrMobileNo[0]; NameOrMobile[1] = "0000000000"; } // string MobileNo = txtName.Text.Split(':')[1];//Take textBox Value After Colon(:) we get Mobile No Hear string post = ddlPost.SelectedItem.Text; //string name = txtName.Text.Trim().Split(':')[0];//Take TextBox Valu before Colon(:) We Get Name Hear string menuType = rdbMenuTag.SelectedItem.Text.Trim(); string ErrorPage; if (menuType == "Setting") { ErrorPage = rdbErrorPageSetting.SelectedItem.Text.Trim(); } else if (menuType == "DBS Report") { ErrorPage = rdbDBSReport.SelectedItem.Text.Trim(); } else { ErrorPage = rdbErrorPageHead.SelectedItem.Text.Trim(); } if (ErrorImgUpload.HasFile) { int length = ErrorImgUpload.PostedFile.ContentLength; byte[] imgbyte = new byte[length]; HttpPostedFile img = ErrorImgUpload.PostedFile; string contentType = ErrorImgUpload.PostedFile.ContentType; //set the binary data img.InputStream.Read(imgbyte, 0, length); string filename = Path.GetFileName(ErrorImgUpload.PostedFile.FileName); strcmd = "Insert into [tblComplaint] ([Post],[Name] ,[MenuType],[Error_PageName],[Error_Description],[Error_PageUrl],[ComplaintDate],[Error_Ans],[Error_Img],[Error_imgType],[Error_imgName],[Contact_No]) OUTPUT inserted.Complaint_Id values(N'" + post + "',N'" + NameOrMobile[0] + "',N'" + menuType + "',N'" + ErrorPage + "',N'" + txtDescription.Text.Trim() + "','" + txtErrorPageUrl.Text.Trim() + "','" + lblQueryDate.Text.Trim() + "','Pending','" + imgbyte + "','" + contentType + "','" + filename + "','" + NameOrMobile[1] + "')"; } else { strcmd = "Insert into [tblComplaint] ([Post],[Name] ,[MenuType],[Error_PageName],[Error_Description],[Error_PageUrl],[ComplaintDate],[Error_Ans],[Contact_No]) OUTPUT inserted.Complaint_Id values(N'" + post + "',N'" + NameOrMobile[0] + "',N'" + menuType + "',N'" + ErrorPage + "',N'" + txtDescription.Text.Trim() + "','" + txtErrorPageUrl.Text.Trim() + "','" + lblQueryDate.Text.Trim() + "','Pending','" + NameOrMobile[1] + "')"; } cmd = new SqlCommand(strcmd, con); // int ComplaintId=0; if (con.State != ConnectionState.Open) { con.Open(); } int ComplentId = (int)cmd.ExecuteScalar(); if (ComplentId > 0) { string Message = string.Empty; Message = " Welcome to P.W (East) D. Pune DBS complaint portal.\n Your complaint has been registered successfully.\n Your compliant Id is: SGPEDBS_00" + ComplentId + " . \n Your compliant will be solved within 7 working days.\n Please visit to http://mahapwddbs.com to check your complaint status."; objSmS.SendSMS(Message, NameOrMobile[1], "", ""); //Send Error Complaint sms to sghitech Message = "Alert of PWD East Pune Error \n Post:- " + post + " \n Name:- " + NameOrMobile[0] + "\n Error Page:- \n" + ErrorPage + " \nDesc:- \n" + txtDescription.Text.Trim() + "\n Url:-" + txtErrorPageUrl.Text.Trim(); objSmS.SendSMS(Message, "9096408111", "", ""); ScriptManager.RegisterClientScriptBlock(this.Page, this.Page.GetType(), "alert", "alert('Your Complaint Send Succesfully...!!!');window.location ='ComplaintForm.aspx';", true); } }