using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; using System.IO; using System.Globalization; using System.Text.RegularExpressions; using CY.Infrastructure.Common; using CY.Model; using CY.WebForm.cs; using CY.BLL; using CY.BLL.Sys; using CY.SendMessage; using CY.Infrastructure; using CY.BLL.OA; using CY.Config; using CY.Infrastructure.Query; using CY.Infrastructure.DESEncrypt; namespace CY.WebForm.Pages.common { /// /// 吴辉 /// 公用ajax访问页 /// public partial class CommonAjax : FrontBasePage { Sys_CitySiteBLL bll_Sys_CitySiteBLL = null; EC_AcceptWayByCustomersBLL bll_EC_AcceptWayByCustomersBLL = null; EC_AcceptWayByOrderBLL bll_EC_AcceptWayByOrderBLL = null; EC_AcceptWayBySellerBLL bll_EC_AcceptWayBySellerBLL = null; Sys_Permissions_MenuBLL bll_Sys_Permissions_MenuBLL = null; Sys_Permissions_UserCaseBLL bll_Sys_Permissions_UserCaseBLL = null; OA_FirmRoleBLL bll_OA_FirmRoleBLL = null; Sys_Permissions_RoleBLL bll_Sys_Permissions_RoleBLL = null; Info_SortBLL bll_Info_SortBLL = null; Info_AdBLL bll_Info_AdBLL = null; Sys_DictionaryBLL bll_Sys_DictionaryBLL = null; OA_CorporateClientsBLL bll_OA_CorporateClientsBLL = null; OA_IntentionCustomerBLL bll_OA_IntentionCustomerBLL = null; EC_MemberBasicBLL bll_EC_MemberBasicBLL = null; OA_StaffBLL bll_OA_StaffBLL = null; OA_DepartmentBll bll_OA_DepartmentBll = null; OA_CustomerApplyBLL bll_OA_CustomerApplyBLL = null; OA_CarManageBll bll_OA_CarManageBll = null; OA_PropertyCateBLL bll_OA_PropertyCateBLL = null; OA_PropertyManageBLL bll_OA_PropertyManageBLL = null; OA_StaffPostBLL bll_OA_StaffPostBLL = null; OA_StaffResumeBLL bll_OA_StaffResumeBLL = null; OA_StaffPostLogBLL bll_OA_StaffPostLogBLL = null; OA_StaffFirmProfileBLL bll_OA_StaffFirmProfileBLL = null; OA_StaffRecruitmentsBLL bll_OA_StaffRecruitmentsBLL = null; OA_WageProcessBLL bll_OA_WageProcessBLL = null; EC_OnlineAdviserBLL bll_EC_OnlineAdviserBLL = null; OA_WageSetPieceBLL bll_OA_WageSetPieceBLL = null; OA_WageManageBLL bll_OA_WageManageBLL = null; OA_WageAwardPunishBLL bll_OA_WageAwardPunishBLL = null; OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = null; public string old_province = ""; public string old_city = ""; public string old_county = ""; //初始化 public CommonAjax() { old_province = ""; old_city = ""; old_county = ""; bll_Sys_CitySiteBLL = new Sys_CitySiteBLL(); bll_EC_AcceptWayByCustomersBLL = new EC_AcceptWayByCustomersBLL(); bll_EC_AcceptWayByOrderBLL = new EC_AcceptWayByOrderBLL(); bll_EC_AcceptWayBySellerBLL = new EC_AcceptWayBySellerBLL(); bll_Sys_DictionaryBLL = new Sys_DictionaryBLL(); bll_Sys_Permissions_MenuBLL = new Sys_Permissions_MenuBLL(); bll_Sys_Permissions_UserCaseBLL = new Sys_Permissions_UserCaseBLL(); bll_Info_SortBLL = new Info_SortBLL(); bll_Info_AdBLL = new Info_AdBLL(); bll_OA_FirmRoleBLL = new OA_FirmRoleBLL(); bll_Sys_Permissions_RoleBLL = new Sys_Permissions_RoleBLL(); bll_OA_CorporateClientsBLL = new OA_CorporateClientsBLL(); bll_OA_IntentionCustomerBLL = new OA_IntentionCustomerBLL(); bll_EC_MemberBasicBLL = new EC_MemberBasicBLL(); bll_OA_StaffBLL = new OA_StaffBLL(); bll_OA_DepartmentBll = new OA_DepartmentBll(); bll_OA_CustomerApplyBLL = new OA_CustomerApplyBLL(); bll_OA_CarManageBll = new OA_CarManageBll(); bll_OA_PropertyCateBLL = new OA_PropertyCateBLL(); bll_OA_PropertyManageBLL = new OA_PropertyManageBLL(); bll_OA_StaffPostBLL = new OA_StaffPostBLL(); bll_OA_StaffResumeBLL = new OA_StaffResumeBLL(); bll_OA_StaffPostLogBLL = new OA_StaffPostLogBLL(); bll_OA_StaffFirmProfileBLL = new OA_StaffFirmProfileBLL(); bll_OA_StaffRecruitmentsBLL = new OA_StaffRecruitmentsBLL(); bll_OA_WageProcessBLL = new OA_WageProcessBLL(); bll_EC_OnlineAdviserBLL = new EC_OnlineAdviserBLL(); bll_OA_WageSetPieceBLL = new OA_WageSetPieceBLL(); bll_OA_WageManageBLL = new OA_WageManageBLL(); bll_OA_WageAwardPunishBLL = new OA_WageAwardPunishBLL(); bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL(); } protected void Page_Load(object sender, EventArgs e) { if (Request["cityType"] == "province") { Response.Write(BindProvince()); } else if (Request["cityType"] == "city") { if (Request["date_type"] == "Name") Response.Write(BindCity(Request["old_province"].ToString2())); else Response.Write(BindCity(Request["old_province"].ToInt32() ?? 0)); } else if (Request["cityType"] == "county") { if (Request["date_type"] == "Name") Response.Write(BindCounty(Request["old_city"].ToString2())); else Response.Write(BindCounty(Request["old_city"].ToInt32() ?? 0)); } else if (Request["rt_datetype"] == "order") { Response.Write(GetOrderReceiptDate(Request["targetid"].ToInt32() ?? 0)); } else if (Request["rt_datetype"] == "member") { Response.Write(GetMemberReceiptDate(Request["targetid"].ToGuid2())); } else if (Request["rt_datetype"] == "customer") { Response.Write(GetCustomerReceiptDate(Request["targetid"].ToGuid2())); } else if (Request["rt_datetype"] == "rttype") { Response.Write(GetRtType()); } else if (Request["rt_datetype"] == "invoice") { Response.Write(GetInvoice()); } else if (Request["verifytype"] == "SMSANDEMAILVerification") { if (WebInfo.Instance.RegisterVerificationType.ToString2() == "SMS") { Response.Write(SendSMSByVerify(Request["verifyvalue"].ToString2())); } else { Response.Write(SendEmailByVerify(Request["verifyvalue"].ToString2())); } } else if (Request["pm_datetype"] == "menu") { Response.Write(GetPermissionsMenus(Request["KeyId"].ToInt32())); } else if (Request["pm_datetype"] == "usercase") { Response.Write(GetUserCase(Request["KeyId"].ToInt32())); } else if (Request["info_datetype"] == "newsinfo") { Response.Write(GetInfoSort(Request["KeyId"].ToInt32())); } else if (Request["ad_datetype"] == "ad") { Response.Write(GetAd(Request["forumname"].ToString2(), Request["locationname"].ToString2())); } else if (Request["role_datetype"] == "staff") { Response.Write(GetMenusByFirmRole(Request["value_keyid"].ToInt32())); } else if (Request["role_datetype"] == "member") { Response.Write(GetMenusByMemberRole(Request["value_keyid"].ToInt32())); } else if (Request["dr_type"] != null) { Response.Write(SetDefaultRole(Request["dr_type"], Request["value_keyid"].ToInt32())); } else if (Request["cor_int_datatype"] == "int") { Response.Write(IntInfoIntoCorInfo(Request["value_keyid"].ToInt32())); } else if (Request["lg_datetype"] == "IsLogin") { Response.Write(IsMemberLogin()); } else if (Request["lg_datetype"] == "login") { Response.Write(LoginDesk(Request["LoginId"].ToString2(), Request["LoginPwd"].ToString2())); } else if (Request["dateType"] == "Domain") { Response.Write(IsExitsDomain(Request["dUrl"], Request["MemberId"].ToGuid2())); } else if (Request["dateType"] == "staffcheckname") { Response.Write(IsExitsStaffName(Request["name"])); } else if (Request["dateType"] == "Departmentcheckname") { Response.Write(IsExitsDepartmentName(Request["name"], Request["Keyid"].ToInt32())); } else if (Request["dateType"] == "editerUploadImage") { Response.Write(UploadImage()); } else if (Request["dateType"] == "editerProcessRequest") { Response.Write(ProcessRequest()); } else if (Request["customchangetype"] == "customchangetype") { Response.Write(ChangeCustom(Request["keyid"].ToGuid2())); } else if (Request["dateType"] == "Exitusercase") { Response.Write(GetNoExitCaseList(Request["menupath"].ToString2())); } else if (Request["dateType"] == "creat_menu_case") { Response.Write(CreatUserCase(Request["menupath"].ToString2(), Request["attrs"].ToString2(), Request["texts"].ToString2())); } else if (Request["dateType"] == "print_cor_int") { Response.Write(PrintAddRecord()); } else if (Request["dateType"] == "carcheckname") { Response.Write(IsExitsCarName(Request["name"], Request["keyid"])); } else if (Request["dateType"] == "propertycheckname") { Response.Write(IsExitsPropertyCateName(Request["name"], Request["keyid"])); } else if (Request["dateType"] == "propertyNamecheckname") { Response.Write(IsExitsPropertyNameCateName(Request["name"], Request["keyid"])); } else if (Request["dateType"] == "resumeCateChange") { Response.Write(GetPostListByCateId(Request["cateId"].ToInt32(), Request["Num"].ToInt32())); } else if (Request["dateType"] == "resumeDeliveryPost") { Response.Write(DeliveryPost(Request["hi"].ToString2())); } else if (Request["dateType"] == "WageProcessCheckName") { Response.Write(IsExitsWageProcessName(Request["name"].ToString2(), Request["keyid"].ToInt32())); } else if (Request["dateType"] == "onlineadviserclick") { Response.Write(AddOnlineAdviserClick(Request["id"].ToInt32())); } else if (Request["dateType"] == "calculatewagepiece") { Response.Write(CalculateWagePiece(Request["wagesetpieceId"].ToInt32(), Request["quantity"].ToInt32())); } else if (Request["dateType"] == "getsoftclirntInfo") { Response.Write(GetClientInfo(Request["id"].ToString2())); } else if (Request["dateType"] == "staffResetPwd") { Response.Write(RestStaffPwd(Request["keyid"].ToInt32())); } else if (!string.IsNullOrEmpty(Request["varitypeforregister"]) && !string.IsNullOrEmpty(Request["dataforregister"])) { Response.Write(CheckDataFromRegister(Request["varitypeforregister"].ToString2(), Request["dataforregister"])); } else if (!string.IsNullOrEmpty(Request["varitypeforcalculatestaffwages"])) { Response.Write(CalculateStaffWages(Request["varitypeforcalculatestaffwages"].ToString2(), Request["staffid"].ToGuid2(), Request["wagestime"])); } else if (!string.IsNullOrEmpty(Request["varitypeforstatisticsstaffwages"])) { Response.Write(StatisticsStaffWages(Request["varitypeforstaffwages"].ToString2(), Request["staffid"].ToGuid2(), Request["AggregatePaychecks"].ToDecimal2(), Request["EducedTotal"].ToDecimal2(), Request["Personal"].ToDecimal2())); } Response.End(); } #region 城市区域 /// /// 获取省级列表 /// /// public string BindProvince() { return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(0, 0, 1)); } /// /// 通过省名称获取市级列表 /// /// 省名称 /// public string BindCity(string Province) { Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByName(Province); if (m_Sys_CitySite == null) { return ""; } else { return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2)); } } /// /// 通过省Keyid获取市级列表 /// /// 省Keyid /// public string BindCity(int Province) { Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(Province); if (m_Sys_CitySite == null) { return ""; } else { return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.Keyid, 0, 2)); } } /// /// 通过市名称获取区县级列表 /// /// 市名称 /// public string BindCounty(string City) { Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByName(City); if (m_Sys_CitySite == null) { return ""; } else { return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, 3)); } } /// /// 通过市Keyid获取区县级列表 /// /// 市Keyid /// public string BindCounty(int City) { Sys_CitySite m_Sys_CitySite = bll_Sys_CitySiteBLL.GetModelByKeyid(City); if (m_Sys_CitySite == null) { return ""; } else { return JsonHelper.GetJsonStringByObject(bll_Sys_CitySiteBLL.SelectAllNextModel(m_Sys_CitySite.ProvinceId, m_Sys_CitySite.Keyid, 3)); } } #endregion #region 收货方式 /// /// 根据来源id获取订单收货方式 /// /// 来源id /// public string GetOrderReceiptDate(int? TargetId) { if (TargetId != null) { return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayByOrderBLL.GetModelByTargetId(TargetId)); } else { return ""; } } /// /// 根据来源id获取会员收货方式 /// /// 来源id /// public string GetMemberReceiptDate(Guid TargetId) { if (TargetId != null) { return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayBySellerBLL.GetModelByTargetId(TargetId)); } else { return ""; } } /// /// 根据来源id获取客户收货方式 /// /// 来源id /// public string GetCustomerReceiptDate(Guid TargetId) { if (TargetId != null) { return JsonHelper.GetJsonStringByObject(bll_EC_AcceptWayByCustomersBLL.GetModelByTargetId(TargetId)); } else { return ""; } } /// /// 获得收货方式 /// /// public string GetRtType() { return JsonHelper.GetJsonStringByObject(bll_Sys_DictionaryBLL.GetDataByType("收货方式")); } /// /// 获得票据要求 /// /// public string GetInvoice() { return JsonHelper.GetJsonStringByObject(bll_Sys_DictionaryBLL.GetDataByType("票据要求")); } #endregion #region 注册验证重复 /// /// 注册验证重复 /// /// /// /// public string CheckDataFromRegister(string varitype, string varidata) { bool result = false; switch (varitype) //验证请求 { case "loginid": //验证登陆账号 result = bll_EC_MemberBasicBLL.ExistMemberByLoginId(varidata); break; case "companyname": //验证公司名称 result = bll_EC_MemberBasicBLL.ExistMemberByCompanyName(varidata); break; case "phone": //验证激活手机 result = bll_EC_MemberBasicBLL.ExistMemberByPhone(varidata); break; case "email": //验证激活邮箱 result = bll_EC_MemberBasicBLL.ExistMemberByEmail(varidata); break; default: return "0"; } return (result ? "1" : "0"); } #endregion #region 验证信息 /// /// 发送验证邮件 /// /// 邮箱 /// public int SendEmailByVerify(string Email) { int VerifyCode = MathRandom.RandomNumber(6); bool result = SendMessage.SendMessge.SendEmail("四川印刷网验证邮件", "亲爱的用户,您好,您的验证码是:" + VerifyCode, Email); if (result) { Session["VerifyCode"] = VerifyCode; Session["VerifyNumber"] = Email; } return result ? 0 : 1; } /// /// 发送验证短信 /// /// 短信 /// public int SendSMSByVerify(string Phone) { int VerifyCode = MathRandom.RandomNumber(6); bool result = SendMessage.SendMessge.SendSMS(Phone, "亲爱的用户,您好,您的验证码是:" + VerifyCode, ""); if (result) { Session["VerifyCode"] = VerifyCode; Session["VerifyNumber"] = Phone; } return result ? 0 : 1; } #endregion #region 权限菜单 /// /// 获取单个权限菜单 /// /// /// public string GetPermissionsMenus(int? KeyId) { if (KeyId != null && KeyId > 0) { return JsonHelper.GetJsonStringByObject(bll_Sys_Permissions_MenuBLL.SelectModelByKeyId(KeyId)); } else { return ""; } } #endregion #region 用例注册 /// /// 获取单个用例注册 /// /// /// public string GetUserCase(int? KeyId) { if (KeyId != null && KeyId > 0) { return JsonHelper.GetJsonStringByObject(bll_Sys_Permissions_UserCaseBLL.SelectModelByKeyId(KeyId)); } else { return ""; } } #endregion #region 网站资讯 /// /// 获取网站资讯分类信息 /// /// /// public string GetInfoSort(int? KeyId) { if (KeyId != null && KeyId > 0) { return JsonHelper.GetJsonStringByObject(bll_Info_SortBLL.SelectModelByKeyId(KeyId)); } else { return ""; } } #endregion #region 网站广告 /// /// 获取广告信息 /// /// /// public string GetAd(string ForumName, string LocationName) { if (!string.IsNullOrEmpty(ForumName) && !string.IsNullOrEmpty(LocationName)) { return bll_Info_AdBLL.SelectAdByLocationName(ForumName, LocationName); } else { return ""; } } #endregion #region 厂商角色权限 /// /// 根据角色编号获取全部权限 /// /// /// public string GetMenusByFirmRole(int? value_keyid) { List m_OA_FirmRolePermissionsRelList = bll_OA_FirmRoleBLL.SelectListByRoleId(value_keyid) as List; if (m_OA_FirmRolePermissionsRelList != null && m_OA_FirmRolePermissionsRelList.Count > 0) { List Menus = new List(); foreach (var m_Sys_Permissions_Menu in m_OA_FirmRolePermissionsRelList) { Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + "0"); string[] fucns = m_Sys_Permissions_Menu.FuncGroup.Split(','); foreach (var item in fucns) { Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + item); } } return JsonHelper.GetJsonStringByObject(Menus); } else return ""; } #endregion #region 会员角色权限 /// /// 根据角色编号获取全部权限 /// /// /// public string GetMenusByMemberRole(int? value_keyid) { List m_Sys_Permissions_RoleMenuRelationList = bll_Sys_Permissions_RoleBLL.SelectListByRoleId(value_keyid) as List; if (m_Sys_Permissions_RoleMenuRelationList != null && m_Sys_Permissions_RoleMenuRelationList.Count > 0) { List Menus = new List(); foreach (var m_Sys_Permissions_Menu in m_Sys_Permissions_RoleMenuRelationList) { Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + "0"); string[] fucns = m_Sys_Permissions_Menu.FuncId.Split(','); foreach (var item in fucns) { Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + item); } } return JsonHelper.GetJsonStringByObject(Menus); } else return ""; } #endregion #region 设置默认角色 /// /// 设置会员默认角色 /// /// /// /// public string SetDefaultRole(string dr_type, int? Keyid) { switch (dr_type) { case "firm": return bll_Sys_Permissions_RoleBLL.SetDefaulFirmRole(Keyid) ? "1" : "-1"; case "shop": return bll_Sys_Permissions_RoleBLL.SetDefaulShopRole(Keyid) ? "1" : "-1"; case "buyer": return bll_Sys_Permissions_RoleBLL.SetDefaulBuyerRole(Keyid) ? "1" : "-1"; default: return "-1"; } } #endregion #region 前台登录窗口 /// /// 前台登录窗口 /// /// /// /// public string LoginDesk(string LoginId, string LoginPwd) { string res = ""; bool result = false; EC_MemberBasic m_EC_MemberBasic = new EC_MemberBasic(); if (string.IsNullOrEmpty(LoginId.ToString2())) { res = "登录帐号不能为空"; } else if (string.IsNullOrEmpty(LoginPwd.ToString2())) { res = "登录密码不能为空"; } else { m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByLogin(LoginId.ToString2(), LoginPwd.ToString2()); if (m_EC_MemberBasic == null || m_EC_MemberBasic.MemberId == null) { res = "帐号或密码错误"; } else { if (m_EC_MemberBasic.MemberType == "印刷厂商" || m_EC_MemberBasic.MemberType == "个人网店" || m_EC_MemberBasic.MemberType == "买家会员" || m_EC_MemberBasic.MemberType == "管理员") { if (m_EC_MemberBasic.UseState != 3) { res = "帐号状态异常,请联系客服"; } else if (m_EC_MemberBasic.ExpirationTime <= DateTime.Now && m_EC_MemberBasic.MemberType == "印刷厂商") { res = "帐号已到期,请联系客服"; } else { m_EC_MemberBasic.TrueMemberId = m_EC_MemberBasic.MemberId; m_EC_MemberBasic.TrueName = m_EC_MemberBasic.Name; m_EC_MemberBasic.TrueType = m_EC_MemberBasic.MemberType; Session["nowMemberLogin"] = m_EC_MemberBasic; //保存登录信息 result = true; } } else { OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(m_EC_MemberBasic.MemberId); if (m_OA_Staff != null) { EC_MemberBasic m_EC_MemberBasic_firm = bll_EC_MemberBasicBLL.GetMemberByMemberId(m_OA_Staff.FirmId); if (m_EC_MemberBasic_firm.UseState != 3) { res = "您所属公司的帐号状态异常,请联系客服"; } else if (m_EC_MemberBasic_firm.ExpirationTime <= DateTime.Now && m_EC_MemberBasic_firm.MemberType == "印刷厂商") { res = "您所属公司的帐号已到期,请联系客服"; } else if (m_EC_MemberBasic.UseState != 3) { res = "帐号状态异常"; } else { m_EC_MemberBasic_firm.TrueMemberId = m_EC_MemberBasic.MemberId; m_EC_MemberBasic_firm.TrueName = m_EC_MemberBasic.Name; m_EC_MemberBasic_firm.TrueType = m_EC_MemberBasic.MemberType; m_EC_MemberBasic_firm.StaffId = m_OA_Staff.Keyid; m_EC_MemberBasic_firm.ShortName = m_EC_MemberBasic.Name; Session["nowMemberLogin"] = m_EC_MemberBasic_firm; //保存登录信息 result = true; } } } if (result) { m_EC_MemberBasic.LastLoginDate = DateTime.Now; m_EC_MemberBasic.LastIp = DNTRequest.GetIP(); if (bll_EC_MemberBasicBLL.UpdateModel(m_EC_MemberBasic)) { res = "success"; } else { res = "登录失败,请稍后再试"; } } } } return res; } /// /// 判断是否登录 /// /// public string IsMemberLogin() { try { if (CurrentUser != null && !string.IsNullOrEmpty(CurrentUser.Name)) return "1"; else return "-1"; } catch (Exception ex) { PAGEHandleException(ex); return "-2"; } } #endregion #region 将意向客户导入合作客户 /// /// 将意向客户导入合作客户 /// /// /// public string IntInfoIntoCorInfo(int? Keyid) { string msg = ""; if (Keyid > 0) { OA_IntentionCustomer m_OA_IntentionCustomer = bll_OA_IntentionCustomerBLL.getSingleIntentionCustomer(Keyid.ToString2()); if (m_OA_IntentionCustomer != null && m_OA_IntentionCustomer.Keyid > 0) { OA_CorporateClients m_OA_CorporateClients = new OA_CorporateClients(); OA_CustomerCommunications m_OA_CustomerCommunications = new OA_CustomerCommunications(); EC_AcceptWayByCustomers m_EC_AcceptWayByCustomers = new EC_AcceptWayByCustomers(); #region 初始合作客户基础信息 m_OA_CorporateClients.CompanyName = m_OA_IntentionCustomer.CompanyName ?? ""; m_OA_CorporateClients.CustomerIndustriesId = m_OA_IntentionCustomer.CustomerIndustriesId ?? 0; m_OA_CorporateClients.CustomerTypeId = m_OA_IntentionCustomer.CustomerTypeId ?? 0; m_OA_CorporateClients.SourcesInfoId = m_OA_IntentionCustomer.SourcesInfoId ?? 0; m_OA_CorporateClients.DegreeImportanId = m_OA_IntentionCustomer.DegreeImportanId ?? 0; m_OA_CorporateClients.AccountManagerId = m_OA_IntentionCustomer.AccountManagerId ?? 0; m_OA_CorporateClients.BusinessManagerId = m_OA_IntentionCustomer.BusinessManagerId ?? 0; m_OA_CorporateClients.CreditId = 0; m_OA_CorporateClients.LoginPhone = ""; m_OA_CorporateClients.LoginPwd = ""; m_OA_CorporateClients.CorporateWebsite = ""; m_OA_CorporateClients.BusinessAnalysisId = 0; m_OA_CorporateClients.IsLoginCorporateWeb = false; m_OA_CorporateClients.Credit = 0; m_OA_CorporateClients.Bank = ""; m_OA_CorporateClients.TaxID = ""; m_OA_CorporateClients.AccountID = ""; m_OA_CorporateClients.OrderCount = 0; m_OA_CorporateClients.OrderMoney = 0; m_OA_CorporateClients.Prepayments = 0; m_OA_CorporateClients.IsOutsourcing = false; m_OA_CorporateClients.OutVendorName = CurrentUser.Name; m_OA_CorporateClients.IsPriority = false; m_OA_CorporateClients.CumulativePrepayments = 0; m_OA_CorporateClients.LastUpdateTime = DateTime.Now; m_OA_CorporateClients.Operator = CurrentUser.ShortName; m_OA_CorporateClients.Remark = m_OA_IntentionCustomer.Remark ?? ""; m_OA_CorporateClients.OutRate = 1; #endregion #region 初始合作客户通讯信息 m_OA_CustomerCommunications.Province = m_OA_IntentionCustomer.Province; m_OA_CustomerCommunications.City = m_OA_IntentionCustomer.City; m_OA_CustomerCommunications.County = m_OA_IntentionCustomer.County; m_OA_CustomerCommunications.DetailedAddress = m_OA_IntentionCustomer.DetailedAddress; m_OA_CustomerCommunications.CompanyPhone = m_OA_IntentionCustomer.PhoneNum; m_OA_CustomerCommunications.Postcode = m_OA_IntentionCustomer.Postcode; m_OA_CustomerCommunications.Mobile = m_OA_IntentionCustomer.MobileNum; m_OA_CustomerCommunications.Fax = ""; m_OA_CustomerCommunications.Email = m_OA_IntentionCustomer.Email; m_OA_CustomerCommunications.QQ = m_OA_IntentionCustomer.QQ; m_OA_CustomerCommunications.LegalRepresentative = ""; m_OA_CustomerCommunications.LegalMobile = ""; m_OA_CustomerCommunications.LegalQQ = ""; m_OA_CustomerCommunications.BusinessManagers = m_OA_IntentionCustomer.BusinessManagers; m_OA_CustomerCommunications.ManagersMobile = ""; m_OA_CustomerCommunications.ManagersQQ = ""; m_OA_CustomerCommunications.FinancialOfficers = ""; m_OA_CustomerCommunications.OfficersMobile = ""; m_OA_CustomerCommunications.OfficersQQ = ""; m_OA_CustomerCommunications.Remark = ""; m_OA_CustomerCommunications.LastUpdateTime = DateTime.Now; m_OA_CustomerCommunications.Operator = CurrentUser.ShortName; #endregion #region 初始合作客户收货地址 m_EC_AcceptWayByCustomers.AcceptTypeId = 0; m_EC_AcceptWayByCustomers.InvoiceDemand = ""; m_EC_AcceptWayByCustomers.Remark = ""; m_EC_AcceptWayByCustomers.LastUpdateTime = DateTime.Now; m_EC_AcceptWayByCustomers.Operator = CurrentUser.ShortName; m_EC_AcceptWayByCustomers.City = ""; m_EC_AcceptWayByCustomers.Accepter = ""; m_EC_AcceptWayByCustomers.AccepterPhone = ""; m_EC_AcceptWayByCustomers.AccepterAddress = ""; m_EC_AcceptWayByCustomers.AccepterPhoneNum = ""; m_EC_AcceptWayByCustomers.AcceptContacts = ""; m_EC_AcceptWayByCustomers.FetchAddress = ""; m_EC_AcceptWayByCustomers.FetchPhoneNum = ""; m_EC_AcceptWayByCustomers.FetchContacts = ""; m_EC_AcceptWayByCustomers.AppointCourierCompany = ""; #endregion m_OA_CorporateClients.Keyid = Guid.NewGuid(); m_OA_CorporateClients.CreateTime = DateTime.Now; m_OA_CorporateClients.CustomerId = bll_OA_CorporateClientsBLL.GetLastIdByFirmId(CurrentUser.MemberId) + 1; m_OA_CorporateClients.FirmId = CurrentUser.MemberId; m_OA_CorporateClients.InquiryId = CurrentUser.InquiryId; m_OA_CorporateClients.MemberId = m_OA_CorporateClients.Keyid; m_OA_CustomerCommunications.Keyid = m_OA_CorporateClients.Keyid; m_EC_AcceptWayByCustomers.TargetId = m_OA_CorporateClients.Keyid; bool result = bll_OA_CorporateClientsBLL.IntIntoModel(m_OA_CorporateClients, m_OA_CustomerCommunications, m_EC_AcceptWayByCustomers, m_OA_IntentionCustomer); if (result) msg = "-1"; else msg = "1"; } else msg = "2"; } else msg = "3"; return msg; } #endregion #region 检测域名是否重复 /// /// 检测域名是否重复 /// /// /// public int IsExitsDomain(string Url, Guid MemberId) { return bll_EC_MemberBasicBLL.IsExitsDomain(Url, MemberId); } #endregion #region 检测员工姓名是否重复 /// /// 检测员工姓名是否重复 /// /// /// public int IsExitsStaffName(string Name) { return bll_OA_StaffBLL.IsExitsName(Name, CurrentUser.MemberId); } #endregion #region 检测部门名称是否重复 /// /// 检测部门名称是否重复 /// /// /// /// public int IsExitsDepartmentName(string Name, int? Keyid) { return bll_OA_DepartmentBll.IsExitsName(Name, CurrentUser.MemberId, Keyid); } #endregion #region 上传 public string UploadImage() { string WebDomain = "http://" + WebInfo.Instance.WebDomain.ToString().Trim('/').Replace("http://", ""); //根目录路径,相对路径 String savePath = "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/"; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ String saveUrl = WebInfo.Instance.WebDomain.ToString2().TrimEnd('/') + "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/"; string fileTypes = "gif,jpg,jpeg,png,bmp"; double maxSize = Convert.ToDouble(WebInfo.Instance.UploadFileSize) * 1024 * 1024; //Convert.ToDouble(file.ContentLength) > Convert.ToDouble(ConfigInfo.Instance().UploadSize) * 1024 * 1024 Hashtable hash = new Hashtable(); HttpPostedFile file = Request.Files["imgFile"]; if (file == null) { hash = new Hashtable(); hash["error"] = 0; hash["url"] = "请选择文件"; return JsonHelper.GetJsonStringByObject(hash); } string dirPath = Server.MapPath("~" + savePath); if (!Directory.Exists(dirPath)) { Directory.CreateDirectory(dirPath); } string fileName = file.FileName; string fileExt = Path.GetExtension(fileName).ToLower(); ArrayList fileTypeList = ArrayList.Adapter(fileTypes.Split(',')); if (file.InputStream == null || file.InputStream.Length > maxSize) { hash = new Hashtable(); hash["error"] = 0; hash["url"] = "上传文件大小超过限制"; return JsonHelper.GetJsonStringByObject(hash); } if (string.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1) { hash = new Hashtable(); hash["error"] = 0; hash["url"] = "上传文件扩展名是不允许的扩展名"; return JsonHelper.GetJsonStringByObject(hash); } string newFileName = DateTime.Now.ToString("yyyyMMddHHmmss_ffff", DateTimeFormatInfo.InvariantInfo) + fileExt; string filePath = dirPath + newFileName; file.SaveAs(filePath); string fileUrl =saveUrl + newFileName; hash = new Hashtable(); hash["error"] = 0; hash["url"] = fileUrl; return JsonHelper.GetJsonStringByObject(hash); } #endregion #region 浏览 public string ProcessRequest() { //String aspxUrl = context.Request.Path.Substring(0, context.Request.Path.LastIndexOf("/") + 1); //根目录路径,相对路径 String rootPath = "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/"; //根目录URL,可以指定绝对路径,比如 http://www.yoursite.com/attached/ String rootUrl = WebInfo.Instance.WebDomain.ToString2().TrimEnd('/') + "/images/Upload/" + DateTime.Now.ToString("yyyyMMdd") + "/"; //图片扩展名 String fileTypes = "gif,jpg,jpeg,png,bmp"; String currentPath = ""; String currentUrl = ""; String currentDirPath = ""; String moveupDirPath = ""; //根据path参数,设置各路径和URL String path = Request.QueryString["path"]; path = String.IsNullOrEmpty(path) ? "" : path; if (path == "") { currentPath = Server.MapPath(rootPath); currentUrl = rootUrl; currentDirPath = ""; moveupDirPath = ""; } else { currentPath = Server.MapPath(rootPath) + path; currentUrl = rootUrl + path; currentDirPath = path; moveupDirPath = Regex.Replace(currentDirPath, @"(.*?)[^\/]+\/$", "$1"); } //排序形式,name or size or type String order = Request.QueryString["order"]; order = String.IsNullOrEmpty(order) ? "" : order.ToLower(); //不允许使用..移动到上一级目录 if (Regex.IsMatch(path, @"\.\.")) { Response.Write("Access is not allowed."); Response.End(); } //最后一个字符不是/ if (path != "" && !path.EndsWith("/")) { Response.Write("Parameter is not valid."); Response.End(); } //目录不存在或不是目录 if (!Directory.Exists(currentPath)) { Response.Write("Directory does not exist."); Response.End(); } //遍历目录取得文件信息 string[] dirList = Directory.GetDirectories(currentPath); string[] fileList = Directory.GetFiles(currentPath); switch (order) { case "size": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new SizeSorter()); break; case "type": Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new TypeSorter()); break; case "name": default: Array.Sort(dirList, new NameSorter()); Array.Sort(fileList, new NameSorter()); break; } Hashtable result = new Hashtable(); result["moveup_dir_path"] = moveupDirPath; result["current_dir_path"] = currentDirPath; result["current_url"] = currentUrl; result["total_count"] = dirList.Length + fileList.Length; List dirFileList = new List(); result["file_list"] = dirFileList; for (int i = 0; i < dirList.Length; i++) { DirectoryInfo dir = new DirectoryInfo(dirList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = true; hash["has_file"] = (dir.GetFileSystemInfos().Length > 0); hash["filesize"] = 0; hash["is_photo"] = false; hash["filetype"] = ""; hash["filename"] = dir.Name; hash["datetime"] = dir.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } for (int i = 0; i < fileList.Length; i++) { FileInfo file = new FileInfo(fileList[i]); Hashtable hash = new Hashtable(); hash["is_dir"] = false; hash["has_file"] = false; hash["filesize"] = file.Length; hash["is_photo"] = (Array.IndexOf(fileTypes.Split(','), file.Extension.Substring(1).ToLower()) >= 0); hash["filetype"] = file.Extension.Substring(1); hash["filename"] = file.Name; hash["datetime"] = file.LastWriteTime.ToString("yyyy-MM-dd HH:mm:ss"); dirFileList.Add(hash); } //Response.AddHeader("Content-Type", "application/json; charset=UTF-8"); //context.Response.Write(JsonMapper.ToJson(result)); //context.Response.End(); return JsonHelper.GetJsonStringByObject(result); } public class NameSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.FullName.CompareTo(yInfo.FullName); } } public class SizeSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.Length.CompareTo(yInfo.Length); } } public class TypeSorter : IComparer { public int Compare(object x, object y) { if (x == null && y == null) { return 0; } if (x == null) { return -1; } if (y == null) { return 1; } FileInfo xInfo = new FileInfo(x.ToString()); FileInfo yInfo = new FileInfo(y.ToString()); return xInfo.Extension.CompareTo(yInfo.Extension); } } public bool IsReusable { get { return true; } } #endregion #region 申请转换线上客户 /// /// 申请转换线上客户 /// /// /// public string ChangeCustom(Guid keyid) { int isExit = bll_OA_CustomerApplyBLL.IsAlreadyApplication(keyid); switch (isExit) { case -1: return "申请失败"; case 1: return "此客户已是线上客户,请勿重复申请"; case 2: return "不存在与此客户名匹配的会员,请检查客户名称是否正确"; case 3: return "此客户已申请转换,请勿重复申请"; case 0: OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(keyid); EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.SelectModleMemberByCompanyName(m_OA_CorporateClients.CompanyName); OA_CustomerApply m_OA_CustomerApply = new OA_CustomerApply(); m_OA_CustomerApply.CustomId = keyid.ToString2(); m_OA_CustomerApply.CustomName = m_OA_CorporateClients.CompanyName; m_OA_CustomerApply.FirmId = CurrentUser.MemberId; m_OA_CustomerApply.FirmName = CurrentUser.Name; m_OA_CustomerApply.LastUpdateTime = DateTime.Now; m_OA_CustomerApply.MemberId = m_EC_MemberBasic.MemberId; m_OA_CustomerApply.MemberName = m_EC_MemberBasic.Name; m_OA_CustomerApply.Operator = CurrentUser.ShortName; m_OA_CustomerApply.Remark = ""; m_OA_CustomerApply.Status = "申请中"; if (bll_OA_CustomerApplyBLL.InsertModel(m_OA_CustomerApply)) return "申请成功,请等待回复"; else return "申请失败"; default: return "操作失败"; } } #endregion #region 根据路径和角色编号去除用例 /// /// 根据路径和角色编号去除用例 /// /// /// public string GetNoExitCaseList(string MenuPath) { try { if (CurrentUser.MemberType == "管理员") { return ""; } else { Sys_Permissions_UserRoleRelation m_Sys_Permissions_UserRoleRelation = bll_Sys_Permissions_RoleBLL.SelectSys_Permissions_UserRoleRelation(CurrentUser.MemberId); MenuPath = MenuPath.Replace("..", ""); var sss = bll_Sys_Permissions_UserCaseBLL.GetNoExitCaseList(MenuPath, m_Sys_Permissions_UserRoleRelation.RoleId); //sss = sss.Where(x => x.Keyid == 12121212121); if (sss != null && sss.Count() > 0) { var aaaa = sss.FirstOrDefault(); var roleRel = bll_OA_FirmRoleBLL.SelectOA_StaffRoleRel(CurrentUser.StaffId); if (roleRel != null) { var m_OA_FirmRolePermissionsRelList = bll_OA_FirmRoleBLL.SelectListByRoleId(roleRel.RoleId).Where(x=>x.MenuIdThree == aaaa.MenuId); if (m_OA_FirmRolePermissionsRelList != null) { List Menus = new List(); foreach (var m_Sys_Permissions_Menu in m_OA_FirmRolePermissionsRelList) { // Menus.Add(m_Sys_Permissions_Menu.MenuIdOne + "-" + m_Sys_Permissions_Menu.MenuIdTwo + "-" + m_Sys_Permissions_Menu.MenuIdThree + "+" + "0"); string[] fucns = m_Sys_Permissions_Menu.FuncGroup.Split(','); foreach (var item in fucns) { Menus.Add(item.ToInt32()); } } sss = sss.Where(x => !Menus.Contains(x.Keyid)); } } } return JsonHelper.GetJsonStringByObject(sss); } } catch (Exception ex) { PAGEHandleException(ex); return ""; } } #endregion #region 创建用例 /// /// 创建用例 /// /// /// /// /// public string CreatUserCase(string menupath, string attrs, string texts) { bll_Sys_Permissions_UserCaseBLL.CreatUserCaseByPage(menupath, attrs, texts); return ""; } #endregion #region 增加商业信函访问数量 /// /// 增加商业信函访问数量 /// public string PrintAddRecord() { string[] Numbers = Request["number"].ToString2().Split(','); if (Numbers.Length > 0) { OA_CustomerAccessRecord m_OA_CustomerAccessRecord = new OA_CustomerAccessRecord(); m_OA_CustomerAccessRecord.AccessContent = ""; m_OA_CustomerAccessRecord.AccesserId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.AccessTypeId = 5; m_OA_CustomerAccessRecord.CreateTime = DateTime.Now; m_OA_CustomerAccessRecord.CustomerId = ""; m_OA_CustomerAccessRecord.CutomerType = (Request["sendfrom"] == "corporate"); m_OA_CustomerAccessRecord.EndTime = DateTime.Now; m_OA_CustomerAccessRecord.LastUpdateTime = DateTime.Now; m_OA_CustomerAccessRecord.Operator = CurrentUser.ShortName; m_OA_CustomerAccessRecord.Receiver = ""; m_OA_CustomerAccessRecord.Remark = CurrentUser.MemberId.ToString2(); m_OA_CustomerAccessRecord.StartTime = DateTime.Now; m_OA_CustomerAccessRecord.StuffId = CurrentUser.StaffId ?? 0; m_OA_CustomerAccessRecord.TurnoverIntention = ""; OA_CustomerAccessRecordBLL bll_OA_CustomerAccessRecordBLL = new OA_CustomerAccessRecordBLL(); bll_OA_CustomerAccessRecordBLL.InsertModelList(Request["number"].ToString2().Trim(',').Split(','), m_OA_CustomerAccessRecord); } return ""; } #endregion #region 检测车牌号是否重复 /// /// 检测车牌号是否重复 /// /// /// /// public int IsExitsCarName(string Name, string Keyid) { return bll_OA_CarManageBll.IsExitsName(Name, CurrentUser.MemberId, Keyid); } #endregion #region 检测行政物品分类是否重复 /// /// 检测行政物品分类是否重复 /// /// /// /// public int IsExitsPropertyCateName(string Name, string Keyid) { return bll_OA_PropertyCateBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid); } #endregion #region 检测行政物品是否重复 /// /// 检测行政物品是否重复 /// /// /// /// public int IsExitsPropertyNameCateName(string Name, string Keyid) { return bll_OA_PropertyManageBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid); } #endregion #region 根据职位类别获取全部职位 public string GetPostListByCateId(int? cateId, int? Num) { string postHtml = ""; if (cateId > 0) { Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; List m_OA_StaffPostList = bll_OA_StaffPostBLL.SelectModelPage(pa, AdminAccount.MemberId, "", null, cateId, null, null, null, "") as List; OA_StaffResumeIntention m_OA_StaffResumeIntention = bll_OA_StaffResumeBLL.GetOA_StaffResumeIntentionByKeyid(CurrentUser.MemberId); int i = 1; foreach (var item in m_OA_StaffPostList) { string CheckedClass = ""; if (m_OA_StaffResumeIntention != null && !string.IsNullOrEmpty(m_OA_StaffResumeIntention.R_I_PostName)) { foreach (var m_var in m_OA_StaffResumeIntention.R_I_PostName.Split(',')) { if (m_var == item.P_Name) { CheckedClass = "checked=\"checked\""; break; } } } postHtml = postHtml + "   " + (i % Num == 0 ? "
" : ""); i++; } } return postHtml; } #endregion #region 投递简历 public int DeliveryPost(string hi) { int result = 0; if (!string.IsNullOrEmpty(hi)) { List deleteKeyIdList = new List(); string deleteKeyIds = Request["hi"].ToString().Trim(','); string[] keyIdArry = deleteKeyIds.Split(','); foreach (string keyId in keyIdArry) { InsertDeliveryPost(keyId.ToInt32()); System.Threading.Thread.Sleep(20); //休眠20毫秒 } } return result; } public bool InsertDeliveryPost(int? PostId) { bool IsSuccess = true; try { OA_StaffRecruitments m_OA_StaffRecruitments = bll_OA_StaffRecruitmentsBLL.GetModelByKeyid(PostId); OA_StaffResume m_OA_StaffResume = bll_OA_StaffResumeBLL.GetModelByMemberid(CurrentUser.MemberId); OA_StaffFirmProfile m_OA_StaffFirmProfile = bll_OA_StaffFirmProfileBLL.GetModelByFirmId(m_OA_StaffRecruitments.FirmId); DateTime nowTime = DateTime.Now; Model.OA_StaffPostLog m_OA_StaffPostLog = new OA_StaffPostLog(); m_OA_StaffPostLog.FirmId = m_OA_StaffRecruitments.FirmId; m_OA_StaffPostLog.MemberId = CurrentUser.MemberId; m_OA_StaffPostLog.Resume_id = m_OA_StaffResume.Keyid; m_OA_StaffPostLog.Recruitments_id = PostId; m_OA_StaffPostLog.PL_Status = 0; m_OA_StaffPostLog.PL_CreatTime = nowTime; m_OA_StaffPostLog.PL_LookStatus = 0; m_OA_StaffPostLog.PL_LookTime = nowTime; m_OA_StaffPostLog.PL_ReplyStatus = 0; m_OA_StaffPostLog.PL_ReplyTime = nowTime; m_OA_StaffPostLog.PL_ReplyContent = ""; m_OA_StaffPostLog.PL_InviteStatus = 0; m_OA_StaffPostLog.PL_InviteCreatTime = nowTime; m_OA_StaffPostLog.PL_InviteTime = ""; m_OA_StaffPostLog.PL_InvitePlace = m_OA_StaffFirmProfile.MP_ResumePlace; m_OA_StaffPostLog.PL_InvitePeople = m_OA_StaffFirmProfile.MP_ResumePeople; m_OA_StaffPostLog.PL_InvitePhone = m_OA_StaffFirmProfile.MP_ResumePhone; m_OA_StaffPostLog.PL_InviteRemark = ""; m_OA_StaffPostLog.PL_InviteCar = m_OA_StaffFirmProfile.MP_ResumeCarWay; m_OA_StaffPostLog.LastUpdateTime = nowTime; m_OA_StaffPostLog.Operator = CurrentUser.ShortName; m_OA_StaffPostLog.Remark = ""; IsSuccess = bll_OA_StaffPostLogBLL.InsertModel(m_OA_StaffPostLog); m_OA_StaffRecruitments.R_ResumeAllCount += 1; m_OA_StaffRecruitments.R_ResumeNewCount += 1; IsSuccess = bll_OA_StaffRecruitmentsBLL.UpdateModel(m_OA_StaffRecruitments); } catch (Exception ex) { PAGEHandleException(ex); return false; } return IsSuccess; } #endregion #region 检测会员工资工序是否重复 /// /// 检测会员工资工序是否重复 /// /// /// /// public int IsExitsWageProcessName(string Name, int? Keyid) { return bll_OA_WageProcessBLL.IsExitsName(Name, CurrentUser.MemberId, Keyid); } #endregion #region 增加在线顾问访问量 /// /// 增加在线顾问访问量 /// /// /// public string AddOnlineAdviserClick(int? Keyid) { string result = ""; try { EC_OnlineAdviser m_EC_OnlineAdviser = bll_EC_OnlineAdviserBLL.GetModelByKeyid(Keyid); m_EC_OnlineAdviser.Quantity += 1; bll_EC_OnlineAdviserBLL.UpdateModel(m_EC_OnlineAdviser); } catch (Exception ex) { PAGEHandleException(ex); } finally { result = ""; } return result; } #endregion #region 计件工资工资计算 /// /// 计件工资工资计算 /// /// /// /// public string CalculateWagePiece(int? WageSetPieceId, int? Quantity) { string res = "0"; try { OA_WageSetPiece m_OA_WageSetPiece = bll_OA_WageSetPieceBLL.GetModelByKeyid(WageSetPieceId); if (m_OA_WageSetPiece != null) { //int? AllCount = Quantity * (m_OA_WageSetPiece.SPS_Unit == "万张" ? 10000 : m_OA_WageSetPiece.SPS_Unit == "千张" ? 1000 : 100); int? AllCount = Quantity; if (AllCount > m_OA_WageSetPiece.SPS_OvercapacityStandard) { if (m_OA_WageSetPiece.SPS_OvercapacityAccounting == "全部产量") { res = (m_OA_WageSetPiece.SPS_OvercapacityWages * AllCount).Value.ToString("0.00"); } else { res = ((m_OA_WageSetPiece.SPS_Wages * m_OA_WageSetPiece.SPS_OvercapacityStandard) + (m_OA_WageSetPiece.SPS_OvercapacityWages * (AllCount - m_OA_WageSetPiece.SPS_OvercapacityStandard))).Value.ToString("0.00"); } } else { res = (m_OA_WageSetPiece.SPS_Wages * AllCount).Value.ToString("0.00"); } } } catch (Exception ex) { PAGEHandleException(ex); res = "0"; } return res; } #endregion #region 根据客户编号获取客户信息 /// /// 根据客户编号获取客户信息 /// /// /// public string GetClientInfo(string Keyid) { OA_CorporateClients m_OA_CorporateClients = bll_OA_CorporateClientsBLL.GetModel(Keyid.ToGuid2()); return JsonHelper.GetJsonStringByObject(m_OA_CorporateClients); } #endregion #region 初始员工密码 /// /// 初始员工密码 /// /// /// public string RestStaffPwd(int? Keyid) { try { string res = "0"; OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByKeyid(Keyid); if (m_OA_Staff.FirmId == CurrentUser.MemberId) { EC_MemberBasic m_EC_MemberBasic = bll_EC_MemberBasicBLL.GetMemberByMemberId(m_OA_Staff.MemberId); m_EC_MemberBasic.Password = DESEncrypt.Encrypt("123456+"); if (bll_EC_MemberBasicBLL.UpdateModel(m_EC_MemberBasic)) { res = "1"; } } return res; } catch (Exception ex) { PAGEHandleException(ex); return "0"; } } #endregion #region 根据员工ID和月份统计员工工资 /// /// 根据员工ID和月份统计员工工资 /// /// /// /// /// public string CalculateStaffWages(string types, Guid staffId, string calculateTimeString) { OA_WagesRecord m_OA_WagesRecord = new OA_WagesRecord(); OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(staffId); OA_WageManage m_OA_WageManage = bll_OA_WageManageBLL.GetModelByMemberId(staffId); DateTime? calculateTimeStart = (calculateTimeString.Replace("年", "-").Replace("月", "-") + "1").ToDateTime2(); DateTime? calculateTimeEnd = calculateTimeStart.Value.AddMonths(1); //奖励和罚款 Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; List m_OA_WageAwardPunishList = bll_OA_WageAwardPunishBLL.SelectModelPageByWage(pa, CurrentUser.MemberId, null, m_OA_Staff.Name, calculateTimeString).ToList(); if (m_OA_WageAwardPunishList != null && m_OA_WageAwardPunishList.Count == 1) { m_OA_WagesRecord.RewardMoney = m_OA_WageAwardPunishList[0].RewardMoney ?? 0; m_OA_WagesRecord.PunishmentMoney = m_OA_WageAwardPunishList[0].PushMoney ?? 0; } //社保缴纳金额 m_OA_WagesRecord.Unit = m_OA_Staff.SM_SocialSecurityFirmMoney ?? 0; m_OA_WagesRecord.Personal = m_OA_Staff.SM_SocialSecuritySelfMoney ?? 0; if (m_OA_WageManage != null) { //业务提成 OA_CustomerAccessRecord m_OA_CustomerAccessRecord = bll_OA_CustomerAccessRecordBLL.SumAccoutingWages(pa, CurrentUser.MemberId, m_OA_Staff.Name, "", calculateTimeStart, calculateTimeEnd); if (m_OA_CustomerAccessRecord != null && m_OA_WageManage.SW_MissionMoney > 0 && m_OA_WageManage.SW_MissionRate > 0 && m_OA_CustomerAccessRecord.NowMoney > m_OA_WageManage.SW_MissionMoney) { m_OA_WagesRecord.Outputcommission = (m_OA_CustomerAccessRecord.NowMoney - m_OA_WageManage.SW_MissionMoney) * m_OA_WageManage.SW_MissionRate / 100; } } return JsonHelper.GetJsonStringByObject(m_OA_WagesRecord); } /// /// 统计员工金额 /// /// 参数判断 /// 员工编号 /// 合计工资(不含基本工资以及工龄工资) /// 应扣工资合计 /// 社保个人应缴纳金额 /// public string StatisticsStaffWages(string types, Guid staffId, decimal? AggregatePaychecks, decimal? EducedTotal, decimal? Personal) { OA_WagesRecord m_OA_WagesRecord = new OA_WagesRecord(); OA_Staff m_OA_Staff = bll_OA_StaffBLL.GetModelByMemberId(staffId); OA_WageManage m_OA_WageManage = bll_OA_WageManageBLL.GetModelByMemberId(staffId); decimal? AllMoney = 0; if (m_OA_WageManage != null) { if (m_OA_WageManage.SW_BasicSalaryType == "基本工资") { AllMoney = AggregatePaychecks - EducedTotal - Personal; if (m_OA_WageManage.SW_WorkAge.ToInt32() > 0 && m_OA_WageManage.SW_WorkAgeMoney > 0) { AllMoney = AllMoney + m_OA_WageManage.SW_WorkAge.ToInt32() * m_OA_WageManage.SW_WorkAgeMoney; } } else if (m_OA_WageManage.SW_BasicSalaryType == "保底工资") { AllMoney = AggregatePaychecks - m_OA_WageManage.SW_BasicSalary - EducedTotal - Personal; if (m_OA_WageManage.SW_BasicSalary > AllMoney) { AllMoney = m_OA_WageManage.SW_BasicSalary; } else { AllMoney = AllMoney; } if (m_OA_WageManage.SW_WorkAge.ToInt32() > 0 && m_OA_WageManage.SW_WorkAgeMoney > 0) { AllMoney = AllMoney + m_OA_WageManage.SW_WorkAge.ToInt32() * m_OA_WageManage.SW_WorkAgeMoney; } } } if (AllMoney > 0) { decimal AfterTaxoney = Config.TaxCalculator.GetAfterTaxByMoney(AllMoney ?? 0); m_OA_WagesRecord.WillPayTax = AllMoney - AfterTaxoney; m_OA_WagesRecord.AmountWagCards = AfterTaxoney; } return JsonHelper.GetJsonStringByObject(m_OA_WagesRecord); } #endregion } }