private ULCode.KeyXmlString getnew(ULCode.KeyXmlString kxs10)
        {
            string[] items = System.Configuration.ConfigurationManager.AppSettings[Request["appid"]].ToString().Split('|');

            ULCode.KeyXmlString kxsnew = new ULCode.KeyXmlString();
            int n = 0;

            foreach (String s in kxs10.GetItemValues("Node"))
            {
                ULCode.KeyXmlString kxs9 = new ULCode.KeyXmlString();
                //kxs9.LoadData(s);
                for (int i = 0; i < items.Length; i++)
                {
                    string[] item_2 = items[i].Split(';');
                    string   uiname = "";
                    if (item_2[0].IndexOf("{") > -1)
                    {
                        uiname = item_2[0].Substring(0, item_2[0].IndexOf("{"));
                    }
                    else
                    {
                        uiname = item_2[0];
                    }
                    kxs9.SetItemValue(uiname, Request["ui_" + uiname + n]);
                }
                kxsnew.AddItem("Node", kxs9.GetSavedData());
                n++;
            }
            return(kxsnew);
        }
Example #2
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            /*
             * string sSql = "select Name from te_companys where ID=11";
             * DbResult dr = ULCode.QDA.XSql.GetData_R(null, sSql);
             * if (dr.OK)
             * {
             *  Response.Write(dr.ToDbValue().ToStr());
             * }*/
            ULCode.KeyXmlString kxs0 = new ULCode.KeyXmlString();
            ULCode.KeyXmlString kxs  = new ULCode.KeyXmlString();
            kxs.SetItemValue("姓名", "孙战平");
            kxs.SetItemValue("性别", "男");
            kxs.SetItemValue("政治面貌", "无");
            kxs0.AddItem("Node", kxs.GetSavedData());

            ULCode.KeyXmlString kxs1 = new ULCode.KeyXmlString();
            kxs1.SetItemValue("姓名", "孙战平1");
            kxs1.SetItemValue("性别", "男1");
            kxs1.SetItemValue("政治面貌", "无1");
            kxs0.AddItem("Node", kxs1.GetSavedData());

            Response.Write(kxs0.GetSavedData());


            ULCode.KeyXmlString kxs10 = new ULCode.KeyXmlString();
            kxs10.LoadData(kxs0.GetSavedData());
            foreach (String s in kxs10.GetItemValues("Node"))
            {
                ULCode.KeyXmlString kxs9 = new ULCode.KeyXmlString();
                kxs9.LoadData(s);
                Response.Write(String.Format("<hr/>姓名:{0} 性别:{1} 政治面貌:{2}"
                                             , kxs9.GetItemValue("姓名")
                                             , kxs9.GetItemValue("性别")
                                             , kxs9.GetItemValue("政治面貌")));
            }
        }
        private void Delete()
        {
            string[]            items = System.Configuration.ConfigurationManager.AppSettings[Request["appid"]].ToString().Split('|');
            ULCode.KeyXmlString kxs10 = new ULCode.KeyXmlString();
            int iR = 0;

            if (Request["table"] == "TU_Employees")
            {
                string         userId   = Request["keyvalue"];
                Employee.MODEL employee = Employee.GetModel("SELECT * FROM TU_Employees WHERE UserID='" + userId + "'");
                try
                {
                    kxs10.LoadData(employee.DFields[Request["column"]].ToString());
                }
                catch { }
                ULCode.KeyXmlString kxsnew = new ULCode.KeyXmlString();
                int n = 0;
                foreach (String s in kxs10.GetItemValues("Node"))
                {
                    if (Request["bu_submitdel" + n] == null)
                    {
                        ULCode.KeyXmlString kxs9 = new ULCode.KeyXmlString();
                        //kxs9.LoadData(s);
                        for (int i = 0; i < items.Length; i++)
                        {
                            string[] item_2 = items[i].Split(';');
                            string   uiname = "";
                            if (item_2[0].IndexOf("{") > -1)
                            {
                                uiname = item_2[0].Substring(0, item_2[0].IndexOf("{"));
                            }
                            else
                            {
                                uiname = item_2[0];
                            }
                            kxs9.SetItemValue(uiname, Request["ui_" + uiname + n]);
                        }
                        kxsnew.AddItem("Node", kxs9.GetSavedData());
                    }
                    n++;
                }


                employee.DFields[Request["column"]].value = kxsnew.GetSavedData();
                iR = employee.Update();
            }
            //5.(用户及业务对象)统计与状态
            //7.返回处理结果或返回其它页面。
            string pagename = "";
            string nexturl  = "";

            switch (Request["column"])
            {
            case "Education": pagename = "员工教育经历"; nexturl = "User_UserList.aspx?CompanyID=11"; break;

            case "Skill": pagename = "员工个人技能"; nexturl = "User_UserList.aspx?CompanyID=11"; break;

            case "Family": pagename = "员工家庭成员"; nexturl = "User_UserList.aspx?CompanyID=11"; break;

            case "Work": pagename = "员工工作经历"; nexturl = "User_UserList.aspx?CompanyID=11"; break;

            case "UrgentLink": pagename = "员工紧急联络人"; nexturl = "User_UserList.aspx?CompanyID=11"; break;

            default: break;
            }
            if (iR > 0)
            {//6.登记日志
                WX.Main.AddLog(WX.LogType.Default, pagename + "删除成功!", "");
                ULCode.Debug.Alert(this, pagename + "删除成功!");
            }
            else
            {
                ULCode.Debug.Alert(Page, pagename + "删除失败!");
            }
        }
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            //1.验证当前用户页面权限
            if (!this.Master.A_Edit)
            {
                Response.Write("你没有权限访问此功能!");
                Response.End();
                return;
            }
            //2.取得用户变量
            //string companyId = this.ddlCompany.SelectedItem.Value;
            //string departmentId = this.departmentId.Value;
            string realName = this.txtRealName.Text.Trim();
            string idCard   = this.txtIDCard.Text.Trim();
            //string position = this.ddlPosition.SelectedItem.Value;
            string birthday = Request.Form["ctl00$ContentPlaceHolder$txtBirthday"];// this.txtBirthday.Text;

            if (!ULCode.Validation.IsDateTime(birthday))
            {
                ULCode.Debug.Alert(this, "日期格式不正确,请正确使用日期控件!");
                return;
            }
            string mobile    = this.txtMobile.Text.Trim();
            bool   sex       = rblSex.SelectedValue == "1" ? true : false;
            string qq        = this.txtQQNumber.Text.Trim();
            string email     = Request.Form["ctl00$ContentPlaceHolder$txtEmail"];//this.txtEmail.Text.Trim();
            string telephone = this.txtTelephone.Text.Trim();
            string address   = this.txtAddress.Text.Trim() + ":" + this.txtaddresscode.Text.Trim() + "|" + this.txtaddress2.Text.Trim() + ":" + this.txtaddress2code.Text.Trim();
            string sort      = this.txtSort.Text.Trim();
            string content   = this.txtContent.Text.Trim();
            //3.验证用户变量,包含Request.QueryString及Request.Form
            string fileExtension = null;

            if (this.FileUpload1.HasFile)
            {
                fileExtension = System.IO.Path.GetExtension(FileUpload1.FileName).ToLower();
                if (!".gif.png.bmp.jpg".Contains(fileExtension))
                {
                    ULCode.Debug.Alert(this, "照片格式必须为图片格式!");
                    return;
                }
            }
            //4.业务处理过程
            if (FileUpload2.HasFile)
            {
                WX.Main.ExecuteDelete("TU_Employees_Credentials", "UserId='" + WX.Main.CurUser.UserID + "' and Name", "身份证扫描件");
                WX.Model.EmployeeCredential.MODEL model = WX.Model.EmployeeCredential.NewDataModel();
                model.Name.value  = "身份证扫描件";
                model.Unit.value  = "公安局";
                model.Ctime.value = (Convert.ToInt32(idCard.Substring(6, 4)) + 18) + "-01-01";
                string filepath = "/UploadFiles/cmp/" + DateTime.Now.ToString("yyyyMMddhhmmssfff") + System.IO.Path.GetExtension(FileUpload2.FileName);
                FileUpload2.SaveAs(Server.MapPath(filepath));
                model.Annex.value  = filepath;
                model.UserId.value = WX.Main.CurUser.UserID;
                model.Save();
            }
            if (FileUpload3.HasFile)
            {
                WX.Main.ExecuteDelete("TU_Employees_Credentials", "UserId='" + WX.Main.CurUser.UserID + "' and Name", ui_edu.SelectedItem.Text + "毕业证扫描件");

                WX.Model.EmployeeCredential.MODEL model = WX.Model.EmployeeCredential.NewDataModel();
                model.Name.value  = ui_edu.SelectedItem.Text + "毕业证扫描件";
                model.Unit.value  = "教育部";
                model.Ctime.value = (Convert.ToInt32(idCard.Substring(6, 4)) + 22) + "-01-01";
                string filepath = "/UploadFiles/cmp/" + DateTime.Now.ToString("yyyyMMddhhmmssfff") + System.IO.Path.GetExtension(FileUpload3.FileName);
                FileUpload3.SaveAs(Server.MapPath(filepath));
                model.Annex.value  = filepath;
                model.UserId.value = WX.Main.CurUser.UserID;
                model.Save();
            }
            if (FileUpload4.HasFile)
            {
                WX.Main.ExecuteDelete("TU_Employees_Credentials", "UserId='" + WX.Main.CurUser.UserID + "' and Name", "健康证扫描件");

                WX.Model.EmployeeCredential.MODEL model = WX.Model.EmployeeCredential.NewDataModel();
                model.Name.value  = "健康证扫描件";
                model.Unit.value  = "卫生部";
                model.Ctime.value = (Convert.ToInt32(idCard.Substring(6, 4)) + 20) + "-01-01";
                string filepath = "/UploadFiles/cmp/" + DateTime.Now.ToString("yyyyMMddhhmmssfff") + System.IO.Path.GetExtension(FileUpload4.FileName);
                FileUpload4.SaveAs(Server.MapPath(filepath));
                model.Annex.value  = filepath;
                model.UserId.value = WX.Main.CurUser.UserID;
                model.Save();
            }
            WX.Main.CurUser.LoadEmployeeUser(false);
            WX.Main.CurUser.LoadUserModel(false);
            WX.Model.User.MODEL usermodel = WX.Main.CurUser.UserModel;
            usermodel.RealName.value = realName;
            usermodel.Update();
            Employee.MODEL employee = WX.Main.CurUser.EmployeeUser;
            #region string filePath=..
            string filePath = null;
            if (FileUpload1.HasFile)
            {
                if (employee.UserFace.isEmpty)
                {
                    string fileDir  = "/UploadFiles/UserPhotos/";
                    string fileName = usermodel.RealName.ToString(); //DateTime.Now.ToString("yyyyMMddHHmmss");
                    filePath = String.Format("{0}{1}{2}", fileDir, fileName, fileExtension);
                }
                else
                {   //如果原文件有则覆盖原文件
                    filePath = employee.UserFace.ToString();
                }
                try
                {
                    FileUpload1.SaveAs(Server.MapPath(filePath));
                }
                catch
                {
                    ULCode.Debug.Alert(this, "照片上传失败,可能是没有写的权限,请与管理员联系!");
                    filePath = null;
                }
            }
            #endregion
            //employee.CompanyID.value = companyId;
            //employee.DepartmentID.value = departmentId;
            //employee.DutyId.value = position;
            employee.IDCard.value   = idCard;
            employee.Sex.value      = sex;
            employee.Birthday.value = birthday;
            employee.Mobile.value   = mobile;
            employee.QQ.value       = qq;
            employee.Email.value    = email;
            employee.Tel.value      = telephone;
            if (!String.IsNullOrEmpty(filePath))
            {
                employee.UserFace.value = filePath;
            }
            employee.Sort.value         = sort;
            employee.Introduction.value = content;
            employee.Titles.value       = this.ui_Titles.Text;
            employee.Ethnic.value       = this.ui_Ethnic.Text;
            employee.Edu.value          = ui_edu.SelectedValue;
            employee.Prof.value         = ui_Prof.Text;
            employee.ForeignL.value     = ui_ForeignL.Text;
            employee.Rating.value       = ui_Rating.Text;
            employee.Marital.value      = ui_Marital.SelectedValue;
            employee.Health.value       = ui_Health.Text;
            employee.Address.value      = address + "|" + ui_jg.Text + "|" + ui_hkd.Text;
            //教育经历
            string[]            items = System.Configuration.ConfigurationManager.AppSettings["Priv-Edu"].ToString().Split('|');
            ULCode.KeyXmlString kxs0  = new ULCode.KeyXmlString();
            if (employee.DFields["Education"].ToString().IndexOf("<KeyXmlString>") > -1)
            {
                kxs0.LoadData(employee.Education.ToString().Replace("&nbsp;", ""));
            }
            if (employee.Education.ToString().IndexOf("<学历>" + ui_edu.SelectedItem.Text + "</学历>") == -1)
            {
                ULCode.KeyXmlString kxs = new ULCode.KeyXmlString();
                kxs.SetItemValue("时间", "");
                kxs.SetItemValue("学历", ui_edu.SelectedItem.Text);
                kxs.SetItemValue("专业", employee.Prof.ToString());
                kxs.SetItemValue("学校", "");
                kxs0.AddItem("Node", kxs.GetSavedData());
                employee.Education.value = kxs0.GetSavedData();
            }
            employee.DepartmentID.value = ddlDepartment.SelectedValue;
            employee.DutyId.value       = ui_jobname.SelectedValue;
            employee.Salary.value       = ui_salary.Text;
            int iR = employee.Update();
            //5.(用户及业务对象)统计与状态
            //6.登记日志
            //7.返回处理结果或返回其它页面。
            if (iR > 0)
            {
                WX.Main.AddLog(WX.LogType.Default, "修改个人信息成功!", "");
                ULCode.Debug.Alert(Page, "个人信息修改成功!请完善下一步“个人技能”", "Priv_Skill.aspx");
            }
            else
            {
                usermodel.RestoreInitial();
                ULCode.Debug.Alert(Page, "个人信息修改失败!");
            }
        }