Пример #1
0
        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                HttpCookie cookie = Request.Cookies["userCookie"];
                if (txtEmpNo.Text.Trim() == "" || txtFullName.Text == "" || txtPassword.Text == "" || txtUsername.Text == "" || ddlShop.SelectedValue == "")
                {
                    MyAlert("warning", "All Fields are Mendatory");
                }
                else
                {
                    WCFS.UserDetails cu = new WCFS.UserDetails();
                    cu.TransType    = 'I';
                    cu.UserName     = txtUsername.Text;
                    cu.Fullname     = txtFullName.Text;
                    cu.Empno        = txtEmpNo.Text;
                    cu.Password     = enc.Encrypt(txtPassword.Text);
                    cu.Shopid       = int.Parse(ddlShop.SelectedValue);
                    cu.WorkFlowList = "";
                    cu.UserCategory = 0;
                    cu.IsDeactive   = 0;
                    cu.Code         = 0;
                    cu.User         = cookie["Name"].ToString();



                    DataTable dt = new DataTable();
                    WCFS.wcf_CreateOperator createUser = new WCFS.wcf_CreateOperator();
                    dt = createUser.InsertUserDetails(cu);
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0][0].ToString() == "1")
                        {
                            MyAlert("success", dt.Rows[0][1].ToString());
                        }
                        else
                        {
                            MyAlert("error", dt.Rows[0][1].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MyAlert("error", ex.Message);
            }
        }
Пример #2
0
        protected void btnSubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (txtEmpNo.Text.Trim() == "" || txtFullName.Text == "" || txtPassword.Text == "" || txtUsername.Text == "" || ddlShop.SelectedValue == "")
                {
                    MyAlert("warning", "All Fields are Mendatory");
                }
                else
                {
                    string WorkFlowList = "";
                    foreach (ListItem item in chkWorkFlowList.Items)
                    {
                        if (item.Selected)
                        {
                            WorkFlowList += item.Value + "|";
                        }
                    }


                    WorkFlowList = WorkFlowList.Remove(WorkFlowList.Length - 1);
                    HttpCookie       cookie = Request.Cookies["userCookie"];
                    WCFS.UserDetails cu     = new WCFS.UserDetails();
                    cu.TransType    = 'I';
                    cu.UserName     = txtUsername.Text;
                    cu.Fullname     = txtFullName.Text;
                    cu.Empno        = txtEmpNo.Text;
                    cu.Password     = enc.Encrypt(txtPassword.Text);
                    cu.Shopid       = int.Parse(ddlShop.SelectedValue);
                    cu.WorkFlowList = WorkFlowList;
                    cu.UserCategory = 1;
                    cu.IsDeactive   = 0;
                    cu.Code         = 0;
                    cu.User         = cookie["Name"].ToString();

                    if (chkDiesel.Checked == true && chkElectric.Checked == true)
                    {
                        cu.LocoCategory = "Diesel | Electric";
                    }
                    else if (chkDiesel.Checked == true)
                    {
                        cu.LocoCategory = "Diesel | 0";
                    }
                    else if (chkElectric.Checked == true)
                    {
                        cu.LocoCategory = "0 | Electric";
                    }
                    else
                    {
                        MyAlert("warning", "LocoCategory Selection Required");
                    }


                    DataTable dt = new DataTable();
                    WCFS.wcf_CreateOperator createUser = new WCFS.wcf_CreateOperator();
                    dt = createUser.InsertUserDetails(cu);
                    if (dt.Rows.Count > 0)
                    {
                        if (dt.Rows[0][0].ToString() == "1")
                        {
                            MyAlert("success", dt.Rows[0][1].ToString());
                        }
                        else
                        {
                            MyAlert("error", dt.Rows[0][1].ToString());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MyAlert("error", ex.Message);
            }
        }