当前位置: 首页>>代码示例>>C#>>正文


C# Org_StaffBLL.Add方法代码示例

本文整理汇总了C#中Org_StaffBLL.Add方法的典型用法代码示例。如果您正苦于以下问题:C# Org_StaffBLL.Add方法的具体用法?C# Org_StaffBLL.Add怎么用?C# Org_StaffBLL.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Org_StaffBLL的用法示例。


在下文中一共展示了Org_StaffBLL.Add方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoImportStaff

        /// <summary>
        /// 导入员工资料
        /// </summary>
        /// <param name="TemplateID"></param>
        /// <param name="Staff"></param>
        /// <param name="StaffSheet"></param>
        /// <param name="State">3:成功 4:失败 5:部分成功</param>
        /// <returns></returns>
        //public string DoImportStaff(int TemplateID, int Client, ISheet StaffSheet, out int State)
        public string DoImportStaff(int TemplateID, int Client, ISheet Sheet, out int State)
        {
            string ImportInfo = "【员工资料】Excel表:";
            State = 0;
            IPT_UploadTemplateBLL _template = new IPT_UploadTemplateBLL(TemplateID);

            List<string> listPDT = new List<string>() { "序号", "姓名", "职务", "手机号码", "关联车号", "身份证号" };

            DataTable dt = null;
            bool flag = VertifySheet(Sheet, listPDT, out dt, ref ImportInfo);
            if (!flag) { State = 4; return ImportInfo; }

            foreach (DataRow dr in dt.Rows)//循环导入数据
            {
                try
                {
                    string _staffName = dr["姓名"].ToString();

                    IList<Org_Staff> _listStaff = Org_StaffBLL.GetStaffList("  Dimission=1 AND OwnerClient=" + _template.Model.ClientID.ToString() + " AND RealName='" + _staffName + "'");
                    if (_listStaff != null && _listStaff.Count > 0)
                    {
                        ImportInfo += string.Format("导入序列号为{0},名字为{1}的数据行时与现有员工名字重复,跳过此行\r\n", dr["序号"].ToString(), _staffName);
                        continue;
                    }

                    int _staffPosition = 0; string _strStaffPosition = dr["职务"].ToString();
                    string _staffPhone = dr["手机号码"].ToString();
                    string _staffIDCode = dr["身份证号"].ToString();
                    if (!string.IsNullOrEmpty(_strStaffPosition))//无职位默认为业代
                    {
                        IList<Org_Position> _listPosition = Org_PositionBLL.GetModelList(" Name='" + _strStaffPosition + "'");
                        if (_listPosition != null && _listPosition.Count > 0) _staffPosition = _listPosition[0].ID;
                    }
                    else { _staffPosition = 1030; }

                    Org_StaffBLL _bllStaff = new Org_StaffBLL();
                    CM_ClientBLL c = new CM_ClientBLL(_template.Model.ClientID);
                    CM_ClientManufactInfo manufactinfo = c.GetManufactInfo();
                    if (c != null && manufactinfo != null)
                    {
                        _bllStaff.Model.OrganizeCity = manufactinfo.OrganizeCity;
                        _bllStaff.Model.OfficialCity = c.Model.OfficialCity;
                    }
                    _bllStaff.Model.RealName = _staffName;
                    _bllStaff.Model.Position = _staffPosition;
                    _bllStaff.Model.Mobile = _staffPhone;
                    _bllStaff.Model.TeleNum = _staffPhone;
                    _bllStaff.Model.IDCode = _staffIDCode;
                    _bllStaff.Model.InsertStaff = _template.Model.InsertStaff;
                    _bllStaff.Model.OwnerClient = _template.Model.ClientID;
                    _bllStaff.Model.OwnerType = 3;
                    _bllStaff.Model.Dimission = 1;
                    _bllStaff.Model.ApproveFlag = 1;
                    int _ClientID = _bllStaff.Add();//当前员工ID
                    //创建默认员工线路
                    if (_ClientID > 0)
                    {
                        if (_bllStaff.Model.Position == 1030)//业待创建默认路线
                        {
                            VST_RouteBLL routebll = new VST_RouteBLL();
                            routebll.Model.Code = "R" + _ClientID.ToString();
                            routebll.Model.Name = "线路-" + _bllStaff.Model.RealName;
                            routebll.Model.RelateStaff = _ClientID;
                            routebll.Model.OrganizeCity = _bllStaff.Model.OrganizeCity;
                            routebll.Model.OwnerClient = _template.Model.ClientID;
                            routebll.Model.OwnerType = 3;
                            routebll.Model.ApproveFlag = 1;
                            routebll.Model.EnableFlag = "Y";
                            routebll.Model.InsertStaff = _template.Model.InsertStaff;
                            routebll.Add();
                        }
                        if (_bllStaff.Model.Position == 1030 || _bllStaff.Model.Position == 1050)//只有业待和司机能关联车号
                        {
                            #region 获取车号ID
                            int _staffCar = 0; string _strStaffCar = dr["关联车号"].ToString();
                            if (!string.IsNullOrEmpty(_strStaffCar))
                            {
                                IList<CM_Vehicle> _listVehicles = CM_VehicleBLL.GetModelList("Client=" + _template.Model.ClientID + " AND VehicleNo='" + _strStaffPosition + "' ");
                                if (_listVehicles != null && _listVehicles.Count > 0) _staffCar = _listVehicles[0].ID;
                                else
                                {
                                    CM_VehicleBLL vehicle = new CM_VehicleBLL();
                                    vehicle.Model.Client = _template.Model.ClientID;
                                    vehicle.Model.VehicleNo = _strStaffCar;
                                    vehicle.Model.State = 1;
                                    vehicle.Model.Remark = "新导入未确认";
                                    vehicle.Model.VehicleClassify = 2;
                                    _staffCar = vehicle.Add();
                                }
                            }
                            #endregion
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:ClientInit.cs

示例2: threadStartImport

        private void threadStartImport(BackgroundWorker worker, DoWorkEventArgs e)
        {
            DataTable dt_OfficialCity = Addr_OfficialCityBLL.GetAllOfficialCity();
            DataTable dt_OrganizeCity = Addr_OrganizeCityBLL.GetAllOrganizeCity();
            DataTable dt_Position = Org_PositionBLL.GetAllPostion();
            bool bFind = false;

            StringBuilder _xhs_success = new StringBuilder("");//成功导入的记录序号(用于定期批量更新导入标志)
            string XH = "";

            #region 导入销售人员资料
            try
            {
                if (cbx_Promotor.Checked)
                {
                    lb_Count.Text = dt_SalesStaff.Rows.Count.ToString();
                    tabControl1.SelectedIndex = 0;
                    XH = "";
                    for (int i = 0; i < dt_SalesStaff.Rows.Count; i++)
                    {
                        worker.ReportProgress((i + 1) * 100 / this.dt_SalesStaff.Rows.Count, i);
                        if (worker.CancellationPending)
                        {
                            e.Cancel = true;
                            break;
                        }
                        XH = dt_SalesStaff.Rows[i]["序号"].ToString();
                        Org_StaffBLL staff = new Org_StaffBLL();

                        //序号
                        if (dt_SalesStaff.Rows[i]["员工工号"].ToString() != "")
                            staff.Model["StaffCode"] = dt_SalesStaff.Rows[i]["员工工号"].ToString();
                        else
                            staff.Model["StaffCode"] = FormatClientCode('S', dt_SalesStaff.Rows[i]["序号"].ToString().Trim(), dt_SalesStaff.Rows[i]["管理片区代码"].ToString().Trim());

                        #region 判断数据是否重复
                        if (Org_StaffBLL.GetStaffList("StaffCode = '" + staff.Model["StaffCode"] + "'").Count > 0)
                        {
                            UpdateImportFlag(1, i, "导入失败,数据重复!");
                            continue;
                        }
                        #endregion

                        //姓名
                        staff.Model["RealName"] = dt_SalesStaff.Rows[i]["姓名"].ToString().Trim();

                        //职务
                        DataRow[] rows_Position = dt_Position.Select("Name = '" + dt_SalesStaff.Rows[i]["职务"].ToString().Trim() + "'");
                        if (rows_Position.Length == 0)
                        {
                            UpdateImportFlag(1, i, "导入失败,职务在系统字典中不存在!");
                            continue;
                        }
                        else
                            staff.Model["Position"] = rows_Position[0]["ID"].ToString().Trim();

                        //管理片区代码
                        DataRow[] rows_OrganizeCity = dt_OrganizeCity.Select("Code='" + dt_SalesStaff.Rows[i]["管理片区代码"].ToString().Trim() + "'");
                        if (rows_OrganizeCity.Length == 0)
                        {
                            UpdateImportFlag(1, i, "导入失败,管理片区代码在系统字典中不存在!");
                            continue;
                        }
                        else
                            staff.Model["OrganizeCity"] = rows_OrganizeCity[0]["ID"].ToString().Trim();

                        //性别
                        staff.Model["Sex"] = dt_SalesStaff.Rows[i]["性别"].ToString();
                        //bFind = false;
                        //foreach (Dictionary_Data item in DictionaryBLL.GetDicCollections("Pub_Sex").Values)
                        //{
                        //    if (item.Name == dt_SalesStaff.Rows[i]["性别"].ToString().Trim())
                        //    {
                        //        staff.Model["Sex"] = item.Code;
                        //        bFind = true;
                        //        break;
                        //    }
                        //}
                        //if (!bFind)
                        //{
                        //    UpdateImportFlag(1, i, "导入失败,性别在系统字典中不存在!");
                        //    continue;
                        //}

                        //联系电话
                        staff.Model["TeleNum"] = dt_SalesStaff.Rows[i]["联系电话"].ToString().Trim();

                        //手机
                        staff.Model["Mobile"] = dt_SalesStaff.Rows[i]["手机"].ToString().Trim();

                        //城市
                        string cityname = dt_SalesStaff.Rows[i]["城市"].ToString().Trim();
                        if (cityname.Length > 3) cityname = cityname.Substring(0, 3);
                        DataRow[] rows_OfficialCity = dt_OfficialCity.Select("Name like '" + cityname + "%'");
                        if (rows_OfficialCity.Length == 0)
                        {
                            UpdateImportFlag(1, i, "导入失败,城市在系统字典中不存在!");
                            continue;
                        }
                        else
//.........这里部分代码省略.........
开发者ID:fuhongliang,项目名称:GraduateProject,代码行数:101,代码来源:Form1.cs


注:本文中的Org_StaffBLL.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。