protected void btnChangeCell_OnClick(object sender, EventArgs e)
 {
     objuser.id     = hidaddress.Value;
     objuser.action = "editcell";
     objuser.phone  = txtCell.Text;
     ds             = objuser.address();
     ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "temp", "<script type='text/javascript'>alert('Your Cell changed successfully!');hidediv();</script>", false);
     bindCell();
 }
        public static string savedata(string id, string companyid, string loginid, string enrollno, string fname, string lname, string password, string usertype, string roles, string managerid, string submitto, string deptid, string desigid, string joindate, string releaseddate, string createdby, string activestatus, string email, string imgurl, string timezone, string dob, string hidaddress, string name, string street, string city, string state, string country, string zip, string addressemail, string phone, string mobile, string fax, string remark, string hidrate, string billrate, string payrate, string overtimeBillRate, string overtimePayrate,
                                      string currencyId, string overheadMulti, string salaryAmount, string appointment)
        {
            ClsUser       objuser = new ClsUser();
            GeneralMethod objgen  = new GeneralMethod();
            DataSet       ds      = new DataSet();
            string        result  = "";


            objuser.id        = id;
            objuser.companyid = companyid;
            objuser.action    = "insert";
            objuser.loginid   = loginid;
            objuser.enrollno  = enrollno;
            objuser.fname     = fname;
            objuser.lname     = lname;
            objuser.password  = password;
            objuser.usertype  = usertype;
            if (objuser.usertype == "Admin")
            {
                objuser.roles = "";
            }
            else
            {
                objuser.roles = roles;
            }
            objuser.managerid    = managerid;
            objuser.submitto     = submitto;
            objuser.deptid       = deptid;
            objuser.desigid      = desigid;
            objuser.joindate     = joindate;
            objuser.releaseddate = releaseddate;
            objuser.createdby    = createdby;
            objuser.activestatus = activestatus;
            objuser.email        = email;
            objuser.imgurl       = imgurl;
            objuser.timezone     = timezone;
            objuser.appointment  = appointment == "1" ? true : false;
            objuser.dob          = dob;
            ds = objuser.ManageEmployee();
            if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["result"].ToString() == "1")
            {
                objuser.action   = "insert";
                objuser.id       = hidaddress;
                objuser.userid   = ds.Tables[0].Rows[0]["nid"].ToString();
                objuser.name     = name;
                objuser.street   = street;
                objuser.city     = city;
                objuser.state    = state;
                objuser.country  = country;
                objuser.usertype = "Employee";
                objuser.zip      = zip;
                objuser.email    = addressemail;
                objuser.phone    = phone;
                objuser.mobile   = mobile;
                objuser.fax      = fax;
                objuser.remark   = remark;
                ds = objuser.address();

                objuser.action = "insert";
                objuser.id     = hidrate;
                objuser.empid  = objuser.userid;
                if (billrate == "")
                {
                    billrate = "0";
                }
                if (payrate == "")
                {
                    payrate = "0";
                }

                if (overtimeBillRate == "")
                {
                    overtimeBillRate = "0";
                }

                if (overtimePayrate == "")
                {
                    overtimePayrate = "0";
                }

                if (overheadMulti == "")
                {
                    overheadMulti = "1";
                }

                if (salaryAmount == "")
                {
                    salaryAmount = "0";
                }
                if (overheadMulti == "")
                {
                    overheadMulti = "1";
                }


                objuser.billrate         = billrate;
                objuser.payrate          = payrate;
                objuser.overtimeBillRate = overtimeBillRate;
                objuser.overtimePayrate  = overtimePayrate;
                objuser.currencyId       = currencyId;
                objuser.overheadMulti    = overheadMulti;
                objuser.salaryAmount     = salaryAmount;

                ds = objuser.emprate();

                result = @"[{""result"":""1"",""msg"":""""}]";
            }
            else
            {
                result = @"[{""result"":""0"",""msg"":""" + ds.Tables[0].Rows[0]["msg"].ToString() + @"""}]";
            }



            return(result);
        }
        /// <summary>
        /// Save information
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            objuser.id        = hidid.Value;
            objuser.companyid = Session["companyid"].ToString();
            objuser.action    = "checkexist";
            objuser.loginid   = txtclientcode.Text;
            ds = objuser.client();
            if (ds.Tables[0].Rows.Count > 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "key", "<script type='text/javascript'>alert('Client ID already exists!');opendiv();fixheader();</script>", false);

                return;
            }
            objuser.action = "insert";

            objuser.clientname  = txtname.Text;
            objuser.companyname = txtcompany.Text;
            objuser.street      = txtstreet1.Text;
            if (dropcountry1.Text != "")
            {
                objuser.country = dropcountry1.SelectedItem.Text;
            }

            else
            {
                objuser.country = "";
            }
            if (dropstate1.Text != "")
            {
                objuser.state = dropstate1.SelectedItem.Text;
            }
            else
            {
                objuser.state = "";
            }
            if (dropcity1.Text != "")
            {
                objuser.city = dropcity1.SelectedItem.Text;
            }
            else
            {
                objuser.city = "";
            }
            objuser.email        = txtemail1.Text;
            objuser.phone        = txtphone1.Text;
            objuser.mobile       = txtcell1.Text;
            objuser.website      = txtwebsite.Text;
            objuser.zip          = txtzip1.Text;
            objuser.activestatus = dropactive.Text;
            objuser.fax          = txtfax1.Text;

            objuser.managerid    = dropmanager.Text;
            objuser.createdby    = Session["userid"].ToString();
            objuser.activestatus = dropactive.Text;
            objuser.desigid      = txtdesignation.Text;
            objuser.address2     = txtaddress2.Text;
            objuser.workphone    = txtworkphone.Text;
            ds = objuser.client();

            if (ds.Tables[0].Rows.Count > 0)
            {
                objuser.id       = hidaddress.Value;
                objuser.userid   = ds.Tables[0].Rows[0]["nid"].ToString();
                objuser.usertype = "Client";
                objuser.name     = txttitle.Text;
                objuser.street   = txtstreet.Text;
                if (dropcountry.Text != "")
                {
                    objuser.country = dropcountry.SelectedItem.Text;
                }
                else
                {
                    objuser.country = "";
                }
                if (dropstate.Text != "")
                {
                    objuser.state = dropstate.SelectedItem.Text;
                }
                else
                {
                    objuser.state = "";
                }
                if (dropcity.Text != "")
                {
                    objuser.city = dropcity.SelectedItem.Text;
                }
                else
                {
                    objuser.city = "";
                }
                objuser.email  = txtemail.Text;
                objuser.phone  = txtphone.Text;
                objuser.mobile = txtcell.Text;
                objuser.remark = txtremark.Text;
                objuser.zip    = txtzip.Text;

                ds = objuser.address();

                string strgroup = "";
                for (int i = 0; i < chkClientGroup.Items.Count; i++)
                {
                    if (chkClientGroup.Items[i].Selected)
                    {
                        strgroup = strgroup + chkClientGroup.Items[i].Value + ",";
                    }
                }
                objuser.clientname = strgroup;
                objuser.id         = objuser.userid;
                objuser.action     = "insertclientingroup";
                ds = objuser.ManageClientGroup();

                blank();
                fillgrid();
                GeneralMethod.alert(this.Page, "Saved Successfully!");
            }
        }
        protected void btnsubmit_Click(object sender, EventArgs e)
        {
            objuser.id        = hidid.Value;
            objuser.companyid = Session["companyid"].ToString();
            objuser.action    = "checkexist";
            objuser.loginid   = txtempid.Text;
            objuser.enrollno  = txtenrollno.Text;
            ds = objuser.ManageEmployee();
            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["etype"].ToString() == "empid")
                {
                    GeneralMethod.alert(this.Page, ds.Tables[0].Rows[0]["msg"].ToString());
                    ScriptManager.RegisterStartupScript(this, GetType(), "key", "<script type='text/javascript'>opendiv();</script>", false);
                    return;
                }
                else
                {
                    if (txtenrollno.Text != "")
                    {
                        GeneralMethod.alert(this.Page, ds.Tables[0].Rows[0]["msg"].ToString());
                        ScriptManager.RegisterStartupScript(this, GetType(), "key", "<script type='text/javascript'>opendiv();</script>", false);
                        return;
                    }
                }
            }
            string strroles = "";

            objuser.action = "insert";

            objuser.fname = txtfname.Text;
            objuser.lname = txtlname.Text;

            objuser.password = txtpassword.Text;
            objuser.usertype = "Employee";

            for (int k = 0; k < reproles.Items.Count; k++)
            {
                CheckBoxList rbtnroles = ((CheckBoxList)reproles.Items[k].FindControl("rbtnroles"));

                for (int i = 0; i < rbtnroles.Items.Count; i++)
                {
                    if (rbtnroles.Items[i].Selected == true)
                    {
                        strroles += rbtnroles.Items[i].Value + "#";
                    }
                }
            }


            objuser.roles = strroles;

            objuser.managerid    = dropmanager.Text;
            objuser.submitto     = dropsubmitto.Text;
            objuser.deptid       = dropdepartment.Text;
            objuser.desigid      = dropdesignation.Text;
            objuser.joindate     = txtjoin.Text;
            objuser.releaseddate = txtrelived.Text;
            objuser.createdby    = Session["userid"].ToString();
            objuser.activestatus = dropactive.Text;
            objuser.email        = txtcompanyemail.Text;
            objuser.imgurl       = dropemptype.Text;
            objuser.timezone     = droptimezone.Text;
            objuser.roletype     = droproletype.Text;
            objuser.dob          = txtdob.Text;
            ds = objuser.ManageEmployee();
            if (ds.Tables[0].Rows.Count > 0)
            {
                objuser.action    = "insert";
                objuser.id        = hidaddress.Value;
                objuser.companyid = Session["companyid"].ToString();
                objuser.userid    = ds.Tables[0].Rows[0]["nid"].ToString();
                objuser.name      = txtlname.Text;
                objuser.street    = txtstreet.Text;
                if (dropcity.Text != "")
                {
                    objuser.city = dropcity.SelectedItem.Text;
                }
                else
                {
                    objuser.city = "";
                }
                if (dropstate.Text != "")
                {
                    objuser.state = dropstate.SelectedItem.Text;
                }
                else
                {
                    objuser.state = "";
                }
                if (dropcountry.Text != "")
                {
                    objuser.country = dropcountry.SelectedItem.Text;
                }
                else
                {
                    objuser.country = "";
                }
                objuser.zip    = txtzip.Text;
                objuser.email  = txtemail.Text;
                objuser.phone  = txtphone.Text;
                objuser.mobile = txtcell.Text;
                objuser.fax    = txtfax.Text;
                objuser.remark = txtremark.Text;
                ds             = objuser.address();

                objuser.action = "insert";
                objuser.id     = hidrate.Value;
                objuser.empid  = objuser.userid;
                if (txtbillrate.Text != "")
                {
                    objuser.billrate = txtbillrate.Text;
                }
                else
                {
                    objuser.billrate = "0.00";
                }

                if (txtpayrate.Text != "")
                {
                    objuser.payrate = txtpayrate.Text;
                }
                else
                {
                    objuser.payrate = "0.00";
                }

                if (txtovertimebill.Text != "")
                {
                    objuser.overtimeBillRate = txtovertimebill.Text;
                }
                else
                {
                    objuser.overtimeBillRate = "0.00";
                }
                if (txtovertimepayrate.Text != "")
                {
                    objuser.overtimePayrate = txtovertimepayrate.Text;
                }
                else
                {
                    objuser.overtimePayrate = "0.00";
                }

                objuser.currencyId = dropcurrency.Text;

                objuser.overheadMulti = txtoverhead.Text;
                if (txtsalary.Text != "")
                {
                    objuser.salaryAmount = txtsalary.Text;
                }
                else
                {
                    objuser.salaryAmount = "0.00";
                }

                ds = objuser.emprate();

                fillgrid();
                if (hidid.Value == "")
                {
                    blank();
                    GeneralMethod.alert(this.Page, "Saved Successfully!");
                }
                else
                {
                    GeneralMethod.alert(this.Page, "Information updated Successfully!");
                }
            }
        }