コード例 #1
0
        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);
        }
コード例 #2
0
        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!");
                }
            }
        }