Пример #1
0
        public Flow GetFlow(int id)
        {
            string    sql = "select * from Flow where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                int              templateId  = Convert.ToInt32(dt.Rows[0]["TemplateID"]);
                FlowTemplate     template    = FlowTemplateLogic.GetInstance().GetFlowTemplate(templateId);
                List <TaskStage> stages      = new List <TaskStage>();
                string           stagesIds   = dt.Rows[0]["Stages"].ToString();
                string[]         stageIdList = stagesIds.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
                foreach (string stageId in stageIdList)
                {
                    TaskStage stage = TaskStageLogic.GetInstance().GetTaskStage(Convert.ToInt32(stageId));
                    if (stage != null)
                    {
                        stages.Add(stage);
                    }
                }
                Flow element = new Flow(Convert.ToInt32(dt.Rows[0]["ID"]), dt.Rows[0]["Name"].ToString(), template, Convert.ToInt32(dt.Rows[0]["CurrentIndex"]), dt.Rows[0]["Remark"].ToString(), stages);
                return(element);
            }
            return(null);
        }
Пример #2
0
        public Permission GetPermission(int id)
        {
            string    sql = "select * from TF_Permission where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Permission perm = new Permission();
                perm.ID        = id;
                perm.Name      = dt.Rows[0]["Name"].ToString();
                perm.IsExcept  = Convert.ToBoolean(dt.Rows[0]["IsExcept"]);
                perm.TheModule = ModuleLogic.GetInstance().GetModule(Convert.ToInt32(dt.Rows[0]["TheModule"]));
                perm.TheAction = ActionLogic.GetInstance().GetAction(Convert.ToInt32(dt.Rows[0]["TheAction"]));
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    perm.Remark = dt.Rows[0]["Remark"].ToString();
                }
                else
                {
                    perm.Remark = "";
                }
                return(perm);
            }
            return(null);
        }
Пример #3
0
        public Dairy GetDairy(int id)
        {
            string    sql = "select * from TF_Dairy where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Dairy element = new Dairy();
                element.ID     = id;
                element.Pos机会籍 = Convert.ToDecimal(dt.Rows[0]["Pos机会籍"]);
                element.Pos机私教 = Convert.ToDecimal(dt.Rows[0]["Pos机私教"]);
                element.现金会籍   = Convert.ToDecimal(dt.Rows[0]["现金会籍"]);
                element.现金私教   = Convert.ToDecimal(dt.Rows[0]["现金私教"]);
                element.微信会籍   = Convert.ToDecimal(dt.Rows[0]["微信会籍"]);
                element.微信私教   = Convert.ToDecimal(dt.Rows[0]["微信私教"]);
                element.现金存水   = Convert.ToDecimal(dt.Rows[0]["现金存水"]);
                element.微信存水   = Convert.ToDecimal(dt.Rows[0]["微信存水"]);
                element.水吧余    = Convert.ToDecimal(dt.Rows[0]["水吧余"]);
                element.总金额    = Convert.ToDecimal(dt.Rows[0]["总金额"]);
                element.备注     = dt.Rows[0]["备注"].ToString();
                element.经手人    = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["经手人"]));
                element.日期     = Convert.ToDateTime(dt.Rows[0]["日期"]);
                return(element);
            }
            return(null);
        }
Пример #4
0
        /// <summary>
        /// 查询单个数据的方法
        /// </summary>
        public DataTable GetOneTable(int id)
        {
            string sqlStr = "select ID as ID,ConfigName as ConfigName,ConfigValue as ConfigValue,ConfigType as ConfigType,Remark as Remark,Extension as Extension,Flag as Flag from TF_Config where ID=@ID";

            SqlParameter[] parms    = { new SqlParameter("@ID", id) };
            DataTable      dtResult = sqlHelper.Query(sqlStr, false, parms);

            return(dtResult);
        }
Пример #5
0
        public TaskInfo GetTaskInfo(int id)
        {
            string    sql = "select * from TaskInfo where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FlowLogic ftl     = FlowLogic.GetInstance();
                TaskInfo  element = new TaskInfo(Convert.ToInt32(dt.Rows[0]["ID"]), Convert.ToInt32(dt.Rows[0]["EntityId"]), ftl.GetFlow(Convert.ToInt32(dt.Rows[0]["FlowID"])), dt.Rows[0]["Sponsor"].ToString(), dt.Rows[0]["Remark"].ToString());
                return(element);
            }
            return(null);
        }
Пример #6
0
        public FieldMap <T, K> GetFieldMap(int id)
        {
            string    sql = "select * from TF_FieldMap where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FieldMap <T, K> element = new FieldMap <T, K>();
                element.ID   = id;
                element.Name = dt.Rows[0]["Name"].ToString();
                element.Map  = (byte[])dt.Rows[0]["Map"];
                return(element);
            }
            return(null);
        }
Пример #7
0
        internal void GetRemoteConfig()
        {
            if (configs == null)
            {
                configs = new List <ConfigEntity>();
            }
            SQLDBHelper sqlHelper = new SQLDBHelper();
            DataTable   dt        = sqlHelper.Query("select * from TF_Config");

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ConfigEntity config = new ConfigEntity();
                    config.id          = Convert.ToInt32(dt.Rows[i]["ID"]);
                    config.configname  = dt.Rows[i]["ConfigName"].ToString();
                    config.configvalue = dt.Rows[i]["ConfigValue"].ToString();
                    config.configtype  = Convert.ToInt32(dt.Rows[i]["ConfigType"]);
                    config.remark      = dt.Rows[i]["Remark"].ToString();
                    config.extension   = Convert.ToInt32(dt.Rows[i]["Extension"]);
                    config.flag        = Convert.ToInt32(dt.Rows[i]["Flag"]);
                    configs.Add(config);
                }
            }
        }
Пример #8
0
        public FormType GetFormType(int id)
        {
            string    sql = "select * from TF_FormType where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FormType element = new FormType();
                element.ID       = id;
                element.TypeName = dt.Rows[0]["TypeName"].ToString();
                element.Flag     = Convert.ToInt32(dt.Rows[0]["Flag"]);
                element.Remark   = dt.Rows[0]["Remark"].ToString();
                return(element);
            }
            return(null);
        }
Пример #9
0
        public CardType GetCardType(int id)
        {
            string    sql = "select * from TF_CardType where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                CardType element = new CardType();
                element.ID     = id;
                element.卡种     = dt.Rows[0]["卡种"].ToString();
                element.是否电子芯片 = Convert.ToBoolean(dt.Rows[0]["是否电子芯片"]);
                element.备注     = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #10
0
        public StaffCondition GetStaffCondition(int id)
        {
            string    sql = "select * from TF_StaffCondition where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                StaffCondition element = new StaffCondition();
                element.ID   = id;
                element.状态   = dt.Rows[0]["状态"].ToString();
                element.是否在职 = Convert.ToBoolean(dt.Rows[0]["是否在职"]);
                element.备注   = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #11
0
        public FollowupType GetFollowupType(int id)
        {
            string    sql = "select * from TF_FollowupType where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FollowupType element = new FollowupType();
                element.ID   = id;
                element.方式   = dt.Rows[0]["方式"].ToString();
                element.Flag = Convert.ToBoolean(dt.Rows[0]["Flag"]);
                element.备注   = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #12
0
        public FormItem GetFormItem(int id)
        {
            string    sql = "select * from TF_FormItem where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FormItem element = new FormItem();
                element.ID        = id;
                element.ItemName  = dt.Rows[0]["ItemName"].ToString();
                element.ItemValue = dt.Rows[0]["ItemValue"].ToString();
                element.ItemType  = dt.Rows[0]["ItemType"].ToString();
                element.Flag      = Convert.ToInt32(dt.Rows[0]["Flag"]);
                return(element);
            }
            return(null);
        }
Пример #13
0
        public FormObject GetFormObject(int id)
        {
            string    sql = "select * from TF_FormObject where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FormObject element = new FormObject();
                element.ID        = id;
                element.FormName  = dt.Rows[0]["FormName"].ToString();
                element.FormType  = FormTypeLogic.GetInstance().GetFormType(Convert.ToInt32(dt.Rows[0]["FormType"]));
                element.FormItems = FormItemLogic.GetInstance().GetFormItemsByIds(dt.Rows[0]["FormItems"].ToString());
                element.Owner     = UserLogic.GetInstance().GetUser(Convert.ToInt32(dt.Rows[0]["Owner"]));
                element.Remark    = dt.Rows[0]["Remark"].ToString();
                return(element);
            }
            return(null);
        }
Пример #14
0
        public Property GetProperty(int id)
        {
            string    sql = "select * from TF_Property where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Property property = new Property();
                property.ID = id;
                property.称  = dt.Rows[0]["名称"].ToString();
                property.单位 = dt.Rows[0]["单位"].ToString();
                property.用途 = dt.Rows[0]["用途"].ToString();
                property.价格 = Convert.ToDecimal(dt.Rows[0]["价格"]);
                property.备注 = dt.Rows[0]["备注"].ToString();
                return(property);
            }
            return(null);
        }
Пример #15
0
        public Attachment GetAttachment(int id)
        {
            string    sql = "select * from TF_Attachment where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Attachment attach = new Attachment();
                attach.ID = id;
                attach.AttachmentFilename = dt.Rows[0]["AttachmentFilename"].ToString();
                attach.Size       = Convert.ToInt64(dt.Rows[0]["Size"]);
                attach.Uploader   = UserLogic.GetInstance().GetUser(Convert.ToInt32(dt.Rows[0]["Uploader"]));
                attach.UploadTime = Convert.ToDateTime(dt.Rows[0]["UploadTime"]);
                attach.Flag       = Convert.ToInt32(dt.Rows[0]["Flag"]);
                return(attach);
            }
            return(null);
        }
Пример #16
0
        public Inventory GetInventory(int id)
        {
            string    sql = "select * from TF_Inventory where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Inventory element = new Inventory();
                element.ID        = id;
                element.PID       = Convert.ToInt32(dt.Rows[0]["PID"]);
                element.IsProduct = Convert.ToBoolean(dt.Rows[0]["IsProduct"]);
                element.IsIncome  = Convert.ToBoolean(dt.Rows[0]["IsIncome"]);
                element.数量        = Convert.ToDecimal(dt.Rows[0]["数量"]);
                element.备注        = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #17
0
        public Renew GetRenew(int id)
        {
            string    sql = "select * from TF_Renew where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Renew element = new Renew();
                element.ID     = id;
                element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[0]["MemberID"]));
                element.卡种     = CardTypeLogic.GetInstance().GetCardType(Convert.ToInt32(dt.Rows[0]["CardType"]));
                element.卡号     = dt.Rows[0]["卡号"].ToString();
                element.续卡时间   = Convert.ToDateTime(dt.Rows[0]["续卡时间"]);
                element.经手人    = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["经手人"]));
                element.备注     = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #18
0
        public Followup GetFollowup(int id)
        {
            string    sql = "select * from TF_Followup where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Followup element = new Followup();
                element.ID     = id;
                element.Member = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[0]["MemberID"]));
                element.回访方式   = FollowupTypeLogic.GetInstance().GetFollowupType(Convert.ToInt32(dt.Rows[0]["跟进方式"]));
                element.跟进结果   = FollowupResultLogic.GetInstance().GetFollowupResult(Convert.ToInt32(dt.Rows[0]["跟进结果"]));
                element.跟进时间   = Convert.ToDateTime(dt.Rows[0]["跟进时间"]);
                element.跟进人    = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["跟进人"]));
                element.备注     = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #19
0
        public Workplan GetWorkplan(int id)
        {
            string    sql = "select * from TF_Workplan where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Workplan element = new Workplan();
                element.ID  = id;
                element.销售  = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["销售"]));
                element.日期  = Convert.ToDateTime(dt.Rows[0]["日期"]);
                element.带人数 = Convert.ToInt32(dt.Rows[0]["带人数"]);
                element.号码数 = Convert.ToInt32(dt.Rows[0]["号码数"]);
                element.成单数 = Convert.ToInt32(dt.Rows[0]["成单数"]);
                element.回访数 = Convert.ToInt32(dt.Rows[0]["回访数"]);
                element.备注  = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #20
0
        public FinanceDetail GetFinanceDetail(int id)
        {
            string    sql = "select * from TF_FinanceDetail where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                FinanceDetail element = new FinanceDetail();
                element.ID   = id;
                element.项目   = dt.Rows[0]["项目"].ToString();
                element.金额   = Convert.ToDecimal(dt.Rows[0]["金额"]);
                element.是否进账 = Convert.ToBoolean(dt.Rows[0]["是否进账"]);
                element.责任人  = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["责任人"]));
                element.备注   = dt.Rows[0]["备注"].ToString();
                element.提交时间 = Convert.ToDateTime(dt.Rows[0]["提交时间"]);
                element.Flag = Convert.ToInt32(dt.Rows[0]["Flag"]);
                return(element);
            }
            return(null);
        }
Пример #21
0
        public PersonalTrain GetPersonalTrain(int id)
        {
            string    sql = "select * from TF_PersonalTrain where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                PersonalTrain element = new PersonalTrain();
                element.ID       = id;
                element.Member   = MemberLogic.GetInstance().GetMember(Convert.ToInt32(dt.Rows[0]["MemberID"]));
                element.私教项目     = dt.Rows[0]["私教项目"].ToString();
                element.次数       = Convert.ToInt32(dt.Rows[0]["次数"]);
                element.开始日期     = Convert.ToDateTime(dt.Rows[0]["开始日期"]);
                element.结束日期     = Convert.ToDateTime(dt.Rows[0]["结束日期"]);
                element.教练       = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["教练"]));
                element.备注       = dt.Rows[0]["备注"].ToString();
                element.SaleTime = Convert.ToDateTime(dt.Rows[0]["SaleTime"]);
                return(element);
            }
            return(null);
        }
Пример #22
0
        public Finance GetFinance(int id)
        {
            string    sql = "select * from TF_Finance where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Finance element = new Finance();
                element.ID     = id;
                element.项目     = dt.Rows[0]["项目"].ToString();
                element.金额     = Convert.ToDecimal(dt.Rows[0]["金额"]);
                element.是否进账   = Convert.ToBoolean(dt.Rows[0]["是否进账"]);
                element.余款     = Convert.ToDecimal(dt.Rows[0]["余款"]);
                element.日期     = Convert.ToDateTime(dt.Rows[0]["日期"]);
                element.经手人    = dt.Rows[0]["经手人"].ToString();
                element.接收人    = dt.Rows[0]["接收人"].ToString();
                element.Detail = dt.Rows[0]["Detail"].ToString();
                return(element);
            }
            return(null);
        }
Пример #23
0
        public UserGroup GetUserGroup(int id)
        {
            string    sql = "select * from TF_UserGroup where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                UserGroup ug = new UserGroup();
                ug.ID   = id;
                ug.Name = dt.Rows[0]["Name"].ToString();
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    ug.Remark = dt.Rows[0]["Remark"].ToString();
                }
                else
                {
                    ug.Remark = "";
                }
                return(ug);
            }
            return(null);
        }
Пример #24
0
        public Action GetAction(int id)
        {
            string    sql = "select * from TF_Action where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Action action = new Action();
                action.ID   = id;
                action.Name = dt.Rows[0]["Name"].ToString();
                if (dt.Rows[0]["FormName"] != null && dt.Rows[0]["FormName"] != DBNull.Value)
                {
                    action.FormName = dt.Rows[0]["FormName"].ToString();
                }
                else
                {
                    action.FormName = "";
                }
                if (dt.Rows[0]["ControlName"] != null && dt.Rows[0]["ControlName"] != DBNull.Value)
                {
                    action.ControlName = dt.Rows[0]["ControlName"].ToString();
                }
                else
                {
                    action.ControlName = "";
                }
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    action.Remark = dt.Rows[0]["Remark"].ToString();
                }
                else
                {
                    action.Remark = "";
                }
                return(action);
            }
            return(null);
        }
Пример #25
0
        public Module GetModule(int id)
        {
            string    sql = "select * from TF_Module where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Module module = new Module();
                module.ID   = id;
                module.Name = dt.Rows[0]["Name"].ToString();
                if (dt.Rows[0]["FormName"] != null && dt.Rows[0]["FormName"] != DBNull.Value)
                {
                    module.FormName = dt.Rows[0]["FormName"].ToString();
                }
                else
                {
                    module.FormName = "";
                }
                if (dt.Rows[0]["ControlName"] != null && dt.Rows[0]["ControlName"] != DBNull.Value)
                {
                    module.ControlName = dt.Rows[0]["ControlName"].ToString();
                }
                else
                {
                    module.ControlName = "";
                }
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    module.Remark = dt.Rows[0]["Remark"].ToString();
                }
                else
                {
                    module.Remark = "";
                }
                return(module);
            }
            return(null);
        }
Пример #26
0
        public Product GetProduct(int id)
        {
            string    sql = "select * from TF_Product where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Product element = new Product();
                element.ID = id;
                element.品名 = dt.Rows[0]["品名"].ToString();
                element.种类 = ProductTypeLogic.GetInstance().GetProductType(Convert.ToInt32(dt.Rows[0]["种类"]));
                element.单位 = dt.Rows[0]["单位"].ToString();
                element.进价 = Convert.ToDecimal(dt.Rows[0]["进价"]);
                element.售价 = Convert.ToDecimal(dt.Rows[0]["售价"]);
                element.厂家 = dt.Rows[0]["厂家"].ToString();
                element.姓名 = dt.Rows[0]["姓名"].ToString();
                element.电话 = dt.Rows[0]["电话"].ToString();
                element.地址 = dt.Rows[0]["地址"].ToString();
                element.备注 = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #27
0
        public Role GetRole(int id)
        {
            string    sql = "select * from TF_Role where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Role role = new Role();
                role.ID          = id;
                role.Name        = dt.Rows[0]["Name"].ToString();
                role.Flag        = Convert.ToBoolean(dt.Rows[0]["Flag"]);
                role.Permissions = Common.GetPermissions(dt.Rows[0]["Permissions"].ToString());
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    role.Remark = dt.Rows[0]["Remark"].ToString();
                }
                else
                {
                    role.Remark = "";
                }
                return(role);
            }
            return(null);
        }
Пример #28
0
        public FlowTemplate GetFlowTemplate(int id)
        {
            string    sql = "select * from FlowTemplate where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                TaskStageTemplateLogic   tsl    = TaskStageTemplateLogic.GetInstance();
                List <TaskStageTemplate> stages = new List <TaskStageTemplate>();
                string        stageIds          = dt.Rows[0]["Stages"].ToString();
                List <string> idList            = Flow.GetSatges(stageIds);
                foreach (string idStr in idList)
                {
                    TaskStageTemplate stage = tsl.GetTaskStageTemplate(Convert.ToInt32(idStr));
                    if (stage != null)
                    {
                        stages.Add(stage);
                    }
                }
                FlowTemplate element = new FlowTemplate(Convert.ToInt32(dt.Rows[0]["ID"]), dt.Rows[0]["Name"].ToString(), stages);
                return(element);
            }
            return(null);
        }
Пример #29
0
        public Worklog GetWorklog(int id)
        {
            string    sql = "select * from TF_Worklog where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                Worklog element = new Worklog();
                element.ID     = id;
                element.销售     = StaffLogic.GetInstance().GetStaff(Convert.ToInt32(dt.Rows[0]["销售"]));
                element.日期     = Convert.ToDateTime(dt.Rows[0]["日期"]);
                element.客户     = dt.Rows[0]["客户"].ToString();
                element.电话     = dt.Rows[0]["电话"].ToString();
                element.是否自访   = Convert.ToBoolean(dt.Rows[0]["是否自访"]);
                element.是否老会员  = Convert.ToBoolean(dt.Rows[0]["是否老会员"]);
                element.是否电话拜访 = Convert.ToBoolean(dt.Rows[0]["是否电话拜访"]);
                element.性别     = (性别)Enum.ToObject(typeof(性别), Convert.ToInt32(dt.Rows[0]["性别"]));
                element.意向     = dt.Rows[0]["意向"].ToString();
                element.住址     = dt.Rows[0]["住址"].ToString();
                element.备注     = dt.Rows[0]["备注"].ToString();
                return(element);
            }
            return(null);
        }
Пример #30
0
        public User GetUser(int id)
        {
            string    sql = "select * from TF_User where ID=" + id;
            DataTable dt  = sqlHelper.Query(sql);

            if (dt != null && dt.Rows.Count > 0)
            {
                User user = new User();
                user.ID          = id;
                user.Username    = dt.Rows[0]["Username"].ToString();
                user.Departments = Common.GetDepartments(dt.Rows[0]["Depart"].ToString());
                user.Flag        = Convert.ToInt32(dt.Rows[0]["Flag"]);
                if (dt.Rows[0]["Password"] != null && dt.Rows[0]["Password"] != DBNull.Value)
                {
                    user.Password = dt.Rows[0]["Password"].ToString();
                }
                else
                {
                    user.Password = "";
                }
                if (dt.Rows[0]["Roles"] != null && dt.Rows[0]["Roles"] != DBNull.Value)
                {
                    user.Roles = Common.GetRoles(dt.Rows[0]["Roles"].ToString());
                }
                if (dt.Rows[0]["Usergroup"] != null && dt.Rows[0]["Usergroup"] != DBNull.Value)
                {
                    user.Usergroups = Common.GetUserGroups(dt.Rows[0]["Usergroup"].ToString());
                }
                if (dt.Rows[0]["Remark"] != null && dt.Rows[0]["Remark"] != DBNull.Value)
                {
                    user.Remark = dt.Rows[0]["Remark"].ToString();
                }
                return(user);
            }
            return(null);
        }