Beispiel #1
0
 public void AddSubUser_EO1(string EO_Mob, string Firstname, string Lastname, string leaderno)
 {
     urUserRegBLLObj.Customermobileno = EO_Mob;
     status = urUserRegBLLObj.BLLSearchUserExist(urUserRegBLLObj);
     if (status > 0)
     {
         string getuserID_Leader = "select usrUserid from usermaster where usrMobileNo='" + leaderno + "'";
         Leader_UserID = cc.ExecuteScalar(getuserID_Leader); // get Leader usruserID
         if (Leader_UserID == "")
         {
         }
         else
         {
             string sql           = "select id from AdminSubMarketingSubUser where friendid='" + Jr_ID + "' and userid='" + Leader_UserID + "'";
             string AlreadyAssign = cc.ExecuteScalar(sql);
             if (AlreadyAssign == "")
             {
                 AddNewUser1(EO_Mob, leaderno);
             }
             else
             {
                 // already Assign
             }
         }
     }
     else
     {
         int Status = Addnew(Fname, Lname, EO_Mob);
         if (Status == 1)
         {
             AddSubUser_EO1(EO_Mob, Fname, Lname, leaderno);
         }
     }
 }
 private void Insert()
 {
     try
     {
         string mobileno = txtContactNo.Text;
         blluserregister.Customermobileno = mobileno.ToString();
         int status = blluserregister.BLLSearchUserExist(blluserregister);
         if (status == 1)
         {
             InsertLongCodeRegistration();
         }
         else
         {
             Response.Write("<script>(alert)('This number is not registered to myct, Plz register first..!!')</script>");
         }
     }
     catch (Exception ex)
     {
     }
 }
Beispiel #3
0
 private void searchRecord()
 {
     urBLL.Customermobileno = txtmobileno.Text;
     status = urBLL.BLLSearchUserExist(urBLL);
     if (status == 1)
     {
         string  sql = "select usrFirstName+' '+usrLastName as FullName from usermaster where usrMobileNo='" + txtmobileno.Text + "'";
         DataSet ds  = cc.ExecuteDataset(sql);
         txtname.Text           = Convert.ToString(ds.Tables[0].Rows[0]["FullName"]);
         name                   = txtname.Text;
         txttransaction.Enabled = true;
         txtPromotional.Enabled = true;
         txtvalidfrom.Enabled   = true;
         txtvalidupto.Enabled   = true;
         btnsubmit.Enabled      = true;
     }
     else
     {
         //ScriptManager.RegisterStartupScript(this, typeof(Page), "msg", "alert('This MobileNo. is not registered to myct.in')", true);
         Response.Write("<script>alert('This MobileNo. is not registered to myct.in')</script>");
     }
 }
Beispiel #4
0
    public void AddSubUser(string mobile, string fname, string lname, string schoolcode, string usrclass, string section, string Hm_usrID)
    {
        try
        {
            DateTime dt         = DateTime.Now; // get current date
            double   d          = 5;            //add hours in time
            double   m          = 48;           //add min in time
            DateTime SystemDate = Convert.ToDateTime(dt).AddHours(d);
            SystemDate   = SystemDate.AddMinutes(m);
            CurrenctDate = SystemDate.ToString("yyyy'-'MM'-'dd HH':'mm':'ss tt''");
            urUserRegBLLObj.Customermobileno = mobile;
            Leader_UserID = Hm_usrID;
            SchoolCode    = schoolcode;
            Fname         = fname;
            Lname         = lname;
            status        = urUserRegBLLObj.BLLSearchUserExist(urUserRegBLLObj);
            if (status > 0)
            {
                if (mobile != "" && mobile.Length == 10)
                {
                    sql   = "select usrUserid from usermaster where usrMobileNo='" + Convert.ToString(mobile) + "'";
                    Jr_ID = cc.ExecuteScalar(sql);

                    sql = "select id from AdminSubMarketingSubUser where   friendid='" + Convert.ToString(Jr_ID) + "' and roleid=76 and userid= '" + Convert.ToString(Hm_usrID) + "'";
                    string Check_HMavailable = cc.ExecuteScalar(sql); // check hm assign or not.
                    if (Check_HMavailable != "" || Check_HMavailable != null)
                    {
                        sql = "select SchoolCode from UDISE_TeacherMaster where junior_id='" + Jr_ID + "' and Active=1";
                        string checkschoolCode = cc.ExecuteScalar(sql); // check hm assign or not.
                        if (checkschoolCode != schoolcode && checkschoolCode != "")
                        {
                            sql = "select id from UDISE_TeacherMaster where junior_id='" + Jr_ID + "' and Class='' and Section='' and Active=1  and  SchoolCode= '" + checkschoolCode + "'";
                            string HM = cc.ExecuteScalar(sql); //  Get Hm
                            if (HM != "" || HM != null)
                            {
                            }
                            else
                            {
                                sql = "Update UDISE_TeacherMaster set Active=0 ,EntryDate='" + CurrenctDate + "'  where SchoolCode= '" + checkschoolCode + "' and junior_id='" + Jr_ID + "'";
                                int Teach = cc.ExecuteNonQuery(sql);// update tecaher status
                                if (Teach == 1)
                                {
                                }
                            }
                        }
                        else
                        {
                            sql = "select id from UDISE_TeacherMaster where junior_id='" + Jr_ID + "' and SchoolCode= '" + schoolcode + "' and Active=1";
                            string Check_TecaherAlredyAssign = cc.ExecuteScalar(sql);// check  current teacher or HM assign or not perticular school code
                            if (Check_TecaherAlredyAssign != "" || Check_TecaherAlredyAssign != null)
                            {
                                sql = "select id from UDISE_TeacherMaster where SchoolCode= '" + schoolcode + "' and Class='" + usrclass + "' and Section='" + section + "' and Active=1 ";
                                string checl_ClassAssign = cc.ExecuteScalar(sql);// check this school code ,class & section already assign or not
                                if (checl_ClassAssign == "" || checl_ClassAssign == null)
                                {
                                    sql = "insert into UDISE_TeacherMaster(leader_id,junior_id,SchoolCode,Class,Section,EntryDate,Active)" +
                                          "values('" + Leader_UserID + "','" + Jr_ID + "','" + schoolcode + "','" + usrclass + "','" + section + "','" + CurrenctDate + "',1)";
                                    int a = cc.ExecuteNonQuery(sql); // add tecaher or Hm in Tecaher Master

                                    if (a == 1)
                                    {
                                        string SQL = "select * from usermaster where usrUserid='" + Jr_ID + "'";
                                        SQL = SQL + "select usrMobileNo  from usermaster where usrUserid='" + Leader_UserID + "'";
                                        DataSet ds = cc.ExecuteDataset(SQL);
                                        if (ds.Tables[0].Rows.Count > 0)
                                        {
                                            // string sqll = "select usrMobileNo  from usermaster where usrUserid='" + Leader_UserID + "'";
                                            // string leaderMobileNo = cc.ExecuteScalar(sqll);
                                            string myMobileNo = Convert.ToString(ds.Tables[0].Rows[0]["usrMobileNo"]);
                                            string myPassword = cc.DESDecrypt(Convert.ToString(ds.Tables[0].Rows[0]["usrPassword"]));
                                            string passwordMessage;
                                            Leader_MobileNo = Convert.ToString(ds.Tables[1].Rows[0]["usrMobileNo"]);
                                            // string passwordMessage = "Dear " + myName + ", Password for ur First Login is " + myPassword + " " + cc.AddSMS(myMobileNo);
                                            if (section == "" && usrclass == "")
                                            {
                                                passwordMessage = "U R Registered as HM for school " + schoolcode + " by " + Leader_MobileNo + " ur login pwd for www.myct.in & www.udisecce.myct.in is " + myPassword + " " + cc.AddSMS(myMobileNo);
                                            }
                                            else
                                            {
                                                passwordMessage = "U R Registered as Teacher for class " + usrclass + "(" + section + ")of school " + schoolcode + " by " + Leader_MobileNo + " send every day DAR sms on 8378977897. Ur password is " + myPassword + " for " + cc.AddSMS(myMobileNo);
                                            }
                                            int smslength = passwordMessage.Length;
                                            cc.SendMessageLongCodeSMS("UDISE", myMobileNo, passwordMessage, smslength);
                                        }
                                    }
                                    else
                                    {
                                    }
                                    // AddNewUser(Hm_usrID, Jr_ID);
                                    AddSubUser_EO1(mobile, Fname, Lname, Leader_MobileNo);
                                }
                                else
                                {
                                    string chkUserId = "select junior_id from UDISE_TeacherMaster where SchoolCode= '" + schoolcode + "' and Class='" + usrclass + "' and Section='" + section + "'";
                                    string TRUserId  = cc.ExecuteScalar(chkUserId); // check this school code ,class & section already assign or not
                                    if (TRUserId == "" || TRUserId == null)
                                    {
                                    }
                                    else
                                    {
                                        sql = "Update UDISE_TeacherMaster set junior_id='" + Jr_ID + "' , EntryDate='" + CurrenctDate + "', Active=1  where SchoolCode= '" + schoolcode + "' and Class='" + usrclass + "' and Section='" + section + "' ";
                                        string UpTeach = Convert.ToString(cc.ExecuteNonQuery(sql)); // update class ,section & school code
                                        if (UpTeach == "" || UpTeach == null)
                                        {
                                            string SQL = "select * from usermaster where usrUserid='" + Jr_ID + "'";
                                            SQL = SQL + "select usrMobileNo  from usermaster where usrUserid='" + Leader_UserID + "'";
                                            DataSet ds = cc.ExecuteDataset(SQL);
                                            if (ds.Tables[0].Rows.Count > 0)
                                            {
                                                // string sqll = "select usrMobileNo  from usermaster where usrUserid='" + Leader_UserID + "'";
                                                // string leaderMobileNo = cc.ExecuteScalar(sqll);
                                                string myMobileNo = Convert.ToString(ds.Tables[0].Rows[0]["usrMobileNo"]);
                                                string myPassword = cc.DESDecrypt(Convert.ToString(ds.Tables[0].Rows[0]["usrPassword"]));
                                                string passwordMessage;
                                                Leader_MobileNo = Convert.ToString(ds.Tables[1].Rows[0]["usrMobileNo"]);
                                                // string passwordMessage = "Dear " + myName + ", Password for ur First Login is " + myPassword + " " + cc.AddSMS(myMobileNo);
                                                if (section == "" && usrclass == "")
                                                {
                                                    passwordMessage = "U R Registered as HM for school " + schoolcode + " by " + Leader_MobileNo + " ur login pwd for www.myct.in & www.udisecce.myct.in is " + myPassword + " " + cc.AddSMS(myMobileNo);
                                                }
                                                else
                                                {
                                                    passwordMessage = "U R Registered as Teacher for class " + usrclass + "(" + section + ")of school " + schoolcode + " by " + Leader_MobileNo + " send every day DAR sms on 8378977897. Ur password is " + myPassword + " for " + cc.AddSMS(myMobileNo);
                                                }
                                                int smslength = passwordMessage.Length;
                                                cc.SendMessageLongCodeSMS("UDISE", myMobileNo, passwordMessage, smslength);
                                            }
                                        }
                                        else
                                        {
                                            //string UDAdmin = "update AdminSubMarketingSubUser set friendid='" + Jr_ID + "' where roleid=41 and friendid='" + TRUserId + "' and reference_id10='"+Leader_UserID+"'";
                                            //int a = cc.ExecuteNonQuery(UDAdmin);
                                        }
                                    }
                                }
                            }
                            else
                            {
                            }
                        }
                    }
                    //else
                    //{
                    //    //string Checkschoolcode = "select SchoolCode from UDISE_TeacherMaster where junior_id='" + frndid + "' and SchoolCode= '" + schoolcode + "'";
                    //    //string Scode = cc.ExecuteScalar(Checkschoolcode);
                    //    //if (Scode == "" || Scode == null)
                    //    //{

                    //    //}
                    //    //else
                    //    //{

                    //    sql = "select SchoolCode from UDISE_TeacherMaster where junior_id='" + Jr_ID + "'";
                    //    string schoolcode1 = cc.ExecuteScalar(sql);
                    //    if (schoolcode1 == "" || schoolcode1 == null)
                    //    {
                    //        sql = "select id from UDISE_TeacherMaster where junior_id='" + Jr_ID + "' and SchoolCode= '" + schoolcode + "'";
                    //        string id = cc.ExecuteScalar(sql);
                    //        if (id == "" || id == null)
                    //        {
                    //            sql = "insert into UDISE_TeacherMaster(leader_id,junior_id,SchoolCode,Class,Section)" +
                    //                                    "values('" + Leader_UserID + "','" + Jr_ID + "','" + schoolcode + "','" + usrclass + "','" + section + "')";
                    //            int a = cc.ExecuteNonQuery(sql);
                    //        }
                    //        else
                    //        {
                    //        }
                    //    }
                    //    else
                    //    {
                    //        string chkUserId = "select junior_id from UDISE_TeacherMaster where SchoolCode= '" + schoolcode + "' and Class='" + usrclass + "' and Section='" + section + "'";
                    //        string TRUserId = cc.ExecuteScalar(chkUserId);
                    //        if (TRUserId == "" || TRUserId == null)
                    //        {

                    //        }
                    //        else
                    //        {
                    //            sql = "Update UDISE_TeacherMaster set junior_id='" + Jr_ID + "' where SchoolCode= '" + schoolcode + "' and Class='" + usrclass + "' and Section='" + section + "'";
                    //            string UpTeach = Convert.ToString(cc.ExecuteNonQuery(sql));
                    //            if (UpTeach == "" || UpTeach == null)
                    //            {

                    //            }
                    //            else
                    //            {
                    //                string UDAdmin = "update AdminSubMarketingSubUser set friendid='" + Jr_ID + "' where roleid=77 and friendid='" + TRUserId + "'";
                    //                int a = cc.ExecuteNonQuery(UDAdmin);
                    //            }
                    //        }
                    //    }
                    //}
                    // }
                }
                else
                {
                    //int Status = Addnew(fname, lname, mobile);
                    //if (Status == 1)
                    //{
                    //    AddSubUser(mobile, fname, lname, schoolcode, usrclass, section, Hm_usrID);
                    //}
                }
            }
            else
            {
                int Status = Addnew(fname, lname, mobile);
                if (Status == 1)
                {
                    AddSubUser(mobile, fname, lname, schoolcode, usrclass, section, Hm_usrID);
                }
            }
        }
        catch (Exception ez)
        {
        }
    }