public void CountryInsertUpdate() { countryBLLObj.countryName = Convert.ToString(txtCountryName.Text); string id = Convert.ToString(Session["MarketingUser"]); if (Convert.ToString(ViewState["countryId"]) == "") { status = countryBLLObj.BLLCountryInsert(countryBLLObj); if (status == 1) { Response.Write("<script>alert('Country Added')</script>"); string maxcntid = "select max(countryId) from CountryMaster"; string id1c = cc.ExecuteScalar(maxcntid); string dateins = DateTime.UtcNow.Date.ToShortDateString();// System.DateTime.Now.Date.ToString(); dateins = cc.ChangeDate(dateins); string insert = "update CountryMaster set insdate='" + dateins + "',userId='" + id + "' where countryId=" + id1c.ToString() + ""; cc.ExecuteNonQuery(insert); } else if (status == 0) { Response.Write("<script>alert('Country Not added')</script>"); } } else { countryBLLObj.countryId = Convert.ToInt32(Convert.ToString(ViewState["countryId"])); status = countryBLLObj.BLLCountryUpdate(countryBLLObj); if (status > 0) { Response.Write("<script>alert('Country Updated')</script>"); string cntid = Convert.ToString(ViewState["countryId"]); string dateupd = DateTime.UtcNow.Date.ToShortDateString(); dateupd = cc.ChangeDate(dateupd); string update = "update CountryMaster set modydate='" + dateupd + "',userId='" + id + "' where countryId=" + cntid.ToString() + ""; cc.ExecuteNonQuery(update); } else { Response.Write("<script>alertalert('Country Exist')</script>"); } } }
protected void btnSubmit_Click(object sender, EventArgs e) { pubAdvBLLObj.AdvId = Convert.ToInt32(ddlAdvId.SelectedItem.Text).ToString(); pubAdvBLLObj.State = ddlState.SelectedItem.Text; pubAdvBLLObj.City = ddlCity.SelectedItem.Text; pubAdvBLLObj.Category = ddlSelectCategory.SelectedItem.Text; pubAdvBLLObj.LocationName = ddlLocation.SelectedItem.Text; pubAdvBLLObj.ValidFrom = Convert.ToDateTime(txtValidFrom.Text).ToString(); pubAdvBLLObj.ValidTo = Convert.ToDateTime(txtValidTo.Text).ToString(); pubAdvBLLObj.Active = ddlIsActive.SelectedItem.Text; string dt = cc.ChangeDate(DateTime.Now.ToShortDateString()); if ((Convert.ToDateTime(pubAdvBLLObj.ValidFrom) >= Convert.ToDateTime(DateTime.Now.ToShortDateString())) && (Convert.ToDateTime(pubAdvBLLObj.ValidTo) >= Convert.ToDateTime(pubAdvBLLObj.ValidFrom))) { bool available = pubAdvBLLObj.BLLAdvtiseCheckIfExist(pubAdvBLLObj); if (available == false) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('The advertise at this location Already Exist...')", true); } else { int j = 0; j = pubAdvBLLObj.InsertPublishAddInfo(pubAdvBLLObj); if (j == 0) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Failed To Publish...')", true); } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Published successfully..')", true); } } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Error:Validfrom date should be greater than oe equal to current date and ValidTo date should be greater or equal to ValidFrom Date.')", true); } }
private void UserAdd() { string data = ""; try { if (rdoCityLocation.SelectedItem.Value == "SC") { ubal.CityName = Convert.ToString(Session["CityNameN"]); } else if (rdoCityLocation.SelectedItem.Value == "DC") { if (cmbCity.SelectedValue != null) { ubal.CityName = Convert.ToString(cmbCity.SelectedItem.Text); } else { ubal.CityName = Convert.ToString(Session["CityNameN"]); } if (cmbDistrict.SelectedValue != null) { ubal.District = Convert.ToString(cmbDistrict.SelectedItem.Text); } else { ubal.District = Convert.ToString(Session["CityNameN"]); } } else if (rdoCityLocation.SelectedItem.Value == "DC") { if (cmbDistrict.SelectedValue != null) { ubal.District = Convert.ToString(cmbDistrict.SelectedItem.Text); } else { ubal.District = Convert.ToString(Session["CityNameN"]); } } if (ddlRole.SelectedValue == "34" || ddlRole.SelectedValue == "35" || ddlRole.SelectedValue == "36") { if (ddlmenselection.SelectedValue == "1") { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text) + "-Public"; ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); string roleid = Convert.ToString(ubal.RoleId1); ubal.RoleId1 = Convert.ToInt32(roleid); } else if (ddlmenselection.SelectedValue == "2") { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text) + "-Govt"; ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); string roleid = Convert.ToString(ubal.RoleId1); ubal.RoleId1 = Convert.ToInt32(roleid); } } else { ubal.RoleName1 = Convert.ToString(ddlRole.SelectedItem.Text); ubal.RoleId1 = Convert.ToInt32(ddlRole.SelectedValue); } ///////////////////////// if (ubal.RoleId1 == 14 || ubal.RoleId1 == 15 || ubal.RoleId1 == 16 || ubal.RoleId1 == 17 || ubal.RoleId1 == 18 || ubal.RoleId1 == 19 || ubal.RoleId1 == 20 || ubal.RoleId1 == 21 || ubal.RoleId1 == 75 || ubal.RoleId1 == 76 || ubal.RoleId1 == 77) { Response.Write("<script>alert('You can not Add this member of Marketing Persons')</script>"); } else { ubal.MONO = Convert.ToString(Session["Mobile"]); ubal.Date = Convert.ToString(cc.ChangeDate(txtDOB.Text)); ubal.Id = Convert.ToString(ViewState["User"]); string sql11 = "select usrUserid,usrFirstName from usermaster where usrMobileNo='" + ubal.MONO + "'"; DataSet ds = new DataSet(); ds = cc.ExecuteDataset(sql11); string usruserid = ds.Tables[0].Rows[0]["usrUserid"].ToString(); //string usruserid = cc.ExecuteScalar(sql11); ///Add Here For EzeeTest Marketing Tree Managment when creating role as marketing person string gt = "select usrUserid,usrFirstName from usermaster where usrMobileNo='" + txtMobileNumber.Text + "'"; DataSet ds0 = new DataSet(); ds0 = cc.ExecuteDataset(gt); string usruserid1 = ds0.Tables[0].Rows[0]["usrUserid"].ToString(); string usrFirstName = ds0.Tables[0].Rows[0]["usrFirstName"].ToString(); string deal = "Update [Come2myCityDB].[come2mycity].[tbl_TreeDemOfMarketingSection] set [Role]='" + ubal.RoleName1 + "',ParentName='" + usrFirstName + "' where [Parent_MobileNo]='" + txtMobileNumber.Text + "'"; cc.ExecuteNonQuery(deal); string deal1 = "Update usermaster set [isMarketingPerson]='Y' where [usrMobileNo]='" + txtMobileNumber.Text + "'"; cc.ExecuteNonQuery(deal1); status = ubal.insertUser(ubal); if (status > 0) { if (ddlRole.SelectedValue == "29") { for (int i = 0; i < chkCommitee.Items.Count; i++) { if (chkCommitee.Items[i].Selected == true) { data = data + "," + chkCommitee.Items[i].Value; //data = data + "," + chkCommitee.Items[i].Value; } } if (data.Length > 1) { data = data.Substring(1); } ubal.Id = Convert.ToString(ViewState["User"]); ubal.Committeeid = data; status = ubal.BLLinsertUserCommittee(ubal); string AddJunior = "update [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser set Mainrole=0 where friendid='" + usruserid + "' "; int Data1 = cc.ExecuteNonQuery(AddJunior); string sql = "insert into [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser(userid,roleid,rolename,friendid,doj,reference_id1,Ref_Ways ,Active ,mainrole)" + "values('" + usruserid + "','" + ubal.RoleId1 + "','" + ubal.RoleName1 + "','" + ubal.Id + "','" + CurrenctDate + "','" + usruserid + "','AddNewUser',1,1)"; string a = cc.ExecuteScalar(sql); } else if (ddlRole.SelectedValue == "28") { data = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31"; ubal.Id = Convert.ToString(ViewState["User"]); ubal.Committeeid = data; status = ubal.BLLinsertUserCommittee(ubal); string AddJunior = "update [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser set Mainrole=0 where friendid='" + usruserid + "' "; int Data1 = cc.ExecuteNonQuery(AddJunior); string sql = "insert into [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser(userid,roleid,rolename,friendid,doj,reference_id1,Ref_Ways,Active ,mainrole)" + "values('" + usruserid + "','" + ubal.RoleId1 + "','" + ubal.RoleName1 + "','" + ubal.Id + "','" + CurrenctDate + "','" + usruserid + "','AddNewUser',1,1)"; string a = cc.ExecuteScalar(sql); } else { string AddJunior = "update [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser set Mainrole=0 where friendid='" + usruserid + "' "; int Data1 = cc.ExecuteNonQuery(AddJunior); string sql = "insert into [Come2myCityDB].[come2mycity].AdminSubMarketingSubUser(userid,roleid,rolename,friendid,doj,reference_id1,Ref_Ways,Active ,mainrole)" + "values('" + usruserid + "','" + ubal.RoleId1 + "','" + ubal.RoleName1 + "','" + ubal.Id + "','" + CurrenctDate + "','" + usruserid + "','AddNewUser',1,1)"; int a = cc.ExecuteNonQuery(sql); } string Sql = "Update UserMaster set IsMarketingPerson='Y' where UsrUserId='" + Convert.ToString(ViewState["User"]) + "'"; cc.ExecuteNonQuery(Sql); //Sql = "update [Come2myCityDB].[dbo].[EzeeDrugsAppDetail] set='10' where mobileNo='" + Convert.ToString(Session["MobileNumber"]) + "'"; //cc.ExecuteNonQuery(Sql); string query = "select id from [Come2myCityDB].[come2mycity].TreeDemo where userid='" + usruserid + "' and Roleid= 1"; string CheckTree = cc.ExecuteScalar(query); // Get leader ID already add in tree digrame if (!(CheckTree == null || CheckTree == "")) { // string check_Available = "select id from TreeDemo where userid='" + JuniorNo_usrID + "' and id=" + CheckTree + " "; string check_Available = "select parentid from [Come2myCityDB].[come2mycity].TreeDemo where userid='" + ubal.Id + "' and Roleid=" + ubal.RoleId1 + ""; string GetID = cc.ExecuteScalar(check_Available); // check leader ID & Juniour Is already define or Not if (!(GetID == null || GetID == "")) { if (CheckTree == GetID) { //Not } else { string Addtree = "insert into [Come2myCityDB].[come2mycity].TreeDemo(userid,parentid,RoleId)values('" + ubal.Id + "','" + CheckTree + "'," + ubal.RoleId1 + ")"; int b = cc.ExecuteNonQuery(Addtree); // add new juniour in tree digrame } } else { string Addtree = "insert into [Come2myCityDB].[come2mycity].TreeDemo(userid,parentid,RoleId)values('" + ubal.Id + "','" + CheckTree + "'," + ubal.RoleId1 + ")"; int b = cc.ExecuteNonQuery(Addtree); // add new juniour in tree digrame } } ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('This Marketing Person Added Successfully')", true); Response.Redirect("../MarketingAdmin/UserList.aspx"); } else { //Page.ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "alert('This Marketing Person is already exist'); window.location.href ='../MarketingAdmin/UserList.aspx';", true); ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('This Marketing Person is already exist')", true); HttpContext.Current.ApplicationInstance.CompleteRequest(); } } ///////////////////////////////////////////////////////////////// } catch (Exception ex) { throw ex; } }
private void ReminderSMS() { try { string currentdate;// = Convert.ToString(System.DateTime.Now.ToLongDateString()); //currentdate = cc.ChangeDate(currentdate); currentdate = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm"); string date = txtDate.Text; date = cc.ChangeDate(date); string time = ddlTime.SelectedItem.Text; string minutes = ddlMinutes.SelectedItem.Text; int smsLength; int smsBalCutCount = 0; string msgSndFrom = Convert.ToString(Session["Mobile"]); string usrIdSn = Convert.ToString(Session["User"]); string paidBal = "select paidCount from userMaster where usrUserId='" + usrIdSn.ToString() + "'"; int bal = Convert.ToInt32(cc.ExecuteScalar(paidBal)); if (bal >= 1) { string sendToMoNo = txtReminMobileno.Text; string[] arrsplit = sendToMoNo.Split(','); int mobilelength = arrsplit.Length; if (mobilelength <= bal) { string Message = txtRemindMsg.Text; smsLength = Message.Length; if (smsLength >= 0 && smsLength <= 160) { smsBalCutCount = arrsplit.Length; } else if (smsLength >= 161 && smsLength <= 306) { smsBalCutCount = 2 * arrsplit.Length; } else if (smsLength >= 307 && smsLength <= 459) { smsBalCutCount = 3 * arrsplit.Length; } else if (smsLength >= 460 && smsLength <= 612) { smsBalCutCount = 4 * arrsplit.Length; } else if (smsLength >= 613 && smsLength <= 765) { smsBalCutCount = 5 * arrsplit.Length; } else if (smsLength >= 766 && smsLength <= 918) { smsBalCutCount = 6 * arrsplit.Length; } else if (smsLength >= 919 && smsLength <= 1071) { smsBalCutCount = 7 * arrsplit.Length; } else if (smsLength >= 1072 && smsLength <= 1224) { smsBalCutCount = 8 * arrsplit.Length; } else if (smsLength >= 1225 && smsLength <= 1377) { smsBalCutCount = 9 * arrsplit.Length; } else if (smsLength >= 1378 && smsLength <= 1530) { smsBalCutCount = 10 * arrsplit.Length; } else { } if (smsBalCutCount < bal && smsLength <= 1683) { string UsrMessage = "Dear Total " + mobilelength + " Customized SMS sent successfully www.myct.in"; smsLength = UsrMessage.Length; cc.SendMessageReminderSMS1("Customized", msgSndFrom, Message, smsLength, date, time, minutes, currentdate); string smsto = txtReminMobileno.Text; smsLength = Message.Length; cc.SendMessageReminderSMS1(msgSndFrom, smsto, Message, smsLength, date, time, minutes, currentdate); //---------------------------Ketan Code------------------------- string balance = Convert.ToString(bal - smsBalCutCount - 1); string sqlCutBalQuery = "update userMaster set paidCount = " + balance + " where usrMobileNo='" + msgSndFrom.ToString() + "'"; int SmsSndSuccess = Convert.ToInt32(cc.ExecuteNonQuery(sqlCutBalQuery)); if (SmsSndSuccess > 0) { int TotalSmsCount = Convert.ToInt16(arrsplit.Length); string Sql = "Insert Into PromotionalSendSMSReport(SendFrom,SendTo,sentMessage,TotalSent,Totallength,TotalSms,balance,EntryDate)" + " Values('" + msgSndFrom + "','" + smsto + "','" + Message + "'," + TotalSmsCount + "," + smsLength + "," + (smsBalCutCount + 1) + "," + balance + ",'" + DateFormat + "')"; int k = cc.ExecuteNonQuery(Sql); if (k == 1) { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('SMS send successfully.')", true); clearReminder(); LoadPaidBal(); } } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('Sorry,You have 1683 character sms allow only.')", true); //clearCustomized(); LoadPaidBal(); } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('You have insufficient Promotional Balance,Please recharge it.')", true); //clearCustomized(); clearReminder(); LoadPaidBal(); } } else { ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('You have insufficient Promotional Balance,Please recharge it.')", true); //clearCustomized(); clearReminder(); LoadPaidBal(); } } catch (Exception ex) { } }