Ejemplo n.º 1
0
        public TeamEntity GetTeamByID(string teamid, string clientid)
        {
            if (string.IsNullOrEmpty(teamid))
            {
                return(null);
            }
            var list = GetTeams(clientid);

            if (list.Where(m => m.TeamID == teamid).Count() > 0)
            {
                return(list.Where(m => m.TeamID == teamid).FirstOrDefault());
            }

            TeamEntity model = new TeamEntity();
            DataTable  dt    = SystemDAL.BaseProvider.GetTeamByID(teamid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.Users = OrganizationBusiness.GetUsers(clientid).Where(m => m.TeamID == model.TeamID).ToList();
                Teams[teamid].Add(model);
            }

            return(model);
        }
Ejemplo n.º 2
0
        public static List <StorageDoc> GetStorageDocDetails(string docid, string clientid)
        {
            DataSet ds = StockDAL.BaseProvider.GetStorageDocDetails(docid);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables["Doc"].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);

                List <StorageDetail> details = new List <StorageDetail>();
                foreach (DataRow detailDR in ds.Tables["Details"].Select("DocID = '" + model.DocID + "'"))
                {
                    StorageDetail detail = new StorageDetail();
                    detail.FillData(detailDR);
                    details.Add(detail);
                }
                model.Details = details;
                var user = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);
                model.UserName = user != null ? user.Name : "";

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 3
0
        public static GoodsDoc GetGoodsDocDetail(string docid, string clientid)
        {
            DataSet  ds    = StockDAL.GetGoodsDocDetail(docid, clientid);
            GoodsDoc model = new GoodsDoc();

            if (ds.Tables.Contains("Doc") && ds.Tables["Doc"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Doc"].Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserCacheByUserID(model.CreateUserID, clientid);

                model.DocTypeStr = CommonBusiness.GetEnumDesc <EnumGoodsDocType>((EnumGoodsDocType)model.DocType);

                if (!string.IsNullOrEmpty(model.ExpressID))
                {
                    model.Express = ExpressCompanyBusiness.GetExpressCompanyDetail(model.ExpressID);
                }
                model.Details = new List <GoodsDocDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    GoodsDocDetail details = new GoodsDocDetail();
                    details.FillData(item);

                    model.Details.Add(details);
                }
            }

            return(model);
        }
Ejemplo n.º 4
0
        public static TaskEntity GetPushTaskForFinishTask(string taskid)
        {
            TaskEntity model = new TaskEntity();
            DataSet    ds    = TaskDAL.BaseProvider.GetPushTaskForFinishTask(taskid);

            if (ds.Tables.Count > 0)
            {
                DataTable taskTB = ds.Tables["OrderTask"];
                if (taskTB.Rows.Count == 1)
                {
                    model = new TaskEntity();
                    model.FillData(taskTB.Rows[0]);
                    model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);
                }
                DataTable orderTB = ds.Tables["Order"];
                if (orderTB != null && orderTB.Rows.Count == 1)
                {
                    OrderEntity order = new OrderEntity();
                    order.FillData(orderTB.Rows[0]);
                    model.Order = order;
                }
            }

            return(model);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 获取日志
        /// </summary>
        /// <returns></returns>
        public static List <LogEntity> GetLogs(string guid, EnumLogObjectType type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientid)
        {
            string tablename = "";

            switch (type)
            {
            case EnumLogObjectType.Customer:
                tablename = "CustomerLog";
                break;

            case EnumLogObjectType.Orders:
                tablename = "OrdersLog";
                break;

            case EnumLogObjectType.OrderTask:
                tablename = "OrderTaskLog";
                break;
            }

            DataTable dt = CommonBusiness.GetPagerData(tablename, "*", "LogGUID='" + guid + "'", "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

            List <LogEntity> list = new List <LogEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                LogEntity model = new LogEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserCacheByUserID(model.CreateUserID, clientid);

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 6
0
        public List <StorageBilling> GetPayableBills(int paystatus, int invoicestatus, string begintime, string endtime, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string clientid)
        {
            List <StorageBilling> list = new List <StorageBilling>();
            DataSet ds = FinanceDAL.BaseProvider.GetPayableBills(paystatus, invoicestatus, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                StorageBilling model = new StorageBilling();
                model.FillData(dr);

                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientid);

                model.PayStatusStr = model.PayStatus == 0 ? "未付款"
                                : model.PayStatus == 1 ? "部分付款"
                                : model.PayStatus == 2 ? "已付款"
                                : model.PayStatus == 9 ? "已删除"
                                : "";

                model.InvoiceStatusStr = model.InvoiceStatus == 0 ? "未开票"
                                : model.InvoiceStatus == 1 ? "部分开票"
                                : model.InvoiceStatus == 2 ? "已开票"
                                : model.InvoiceStatus == 9 ? "已删除"
                                : "";

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 7
0
        public static List <TaskEntity> GetTasksByEndTime(string startEndTime, string endEndTime,
                                                          int orderType, int filterType, int finishStatus, int preFinishStatus, int taskType,
                                                          string userID, string clientID, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            List <TaskEntity> list = new List <TaskEntity>();
            DataSet           ds   = TaskDAL.BaseProvider.GetTasksByEndTime(startEndTime, endEndTime,
                                                                            orderType, filterType, finishStatus, preFinishStatus, taskType,
                                                                            userID, clientID, pageSize, pageIndex, ref totalCount, ref pageCount);
            DataTable dt     = ds.Tables["Tasks"];
            DataTable orders = ds.Tables["Orders"];

            foreach (DataRow dr in dt.Rows)
            {
                TaskEntity model = new TaskEntity();
                model.FillData(dr);
                model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);
                if (orders.Rows.Count > 0)
                {
                    foreach (DataRow dr2 in orders.Select(" OrderID='" + model.OrderID + "'"))
                    {
                        OrderEntity order = new OrderEntity();
                        order.FillData(dr2);
                        model.Order = order;
                    }
                }

                if (model.FinishStatus == 1)
                {
                    if (model.EndTime <= DateTime.Now)
                    {
                        model.WarningStatus = 2;
                        model.WarningTime   = "超期:" + (DateTime.Now - model.EndTime).Days.ToString("D2") + "天 " + (DateTime.Now - model.EndTime).Hours.ToString("D2") + "时 " + (DateTime.Now - model.EndTime).Minutes.ToString("D2") + "分";
                        model.WarningDays   = (DateTime.Now - model.EndTime).Days;
                        model.UseDays       = (model.EndTime - model.AcceptTime).Days;
                    }
                    else if ((model.EndTime - DateTime.Now).TotalHours * 3 < (model.EndTime - model.AcceptTime).TotalHours)
                    {
                        model.WarningStatus = 1;
                        model.WarningTime   = "剩余:" + (model.EndTime - DateTime.Now).Days.ToString("D2") + "天 " + (model.EndTime - DateTime.Now).Hours.ToString("D2") + "时 " + (model.EndTime - DateTime.Now).Minutes.ToString("D2") + "分";
                        model.WarningDays   = (model.EndTime - DateTime.Now).Days;
                        model.UseDays       = (DateTime.Now - model.AcceptTime).Days;
                    }
                    else
                    {
                        model.WarningTime = "剩余:" + (model.EndTime - DateTime.Now).Days.ToString("D2") + "天 " + (model.EndTime - DateTime.Now).Hours.ToString("D2") + "时 " + (model.EndTime - DateTime.Now).Minutes.ToString("D2") + "分";
                        model.WarningDays = (model.EndTime - DateTime.Now).Days;
                        model.UseDays     = (DateTime.Now - model.AcceptTime).Days;
                    }
                }
                else
                {
                    model.WarningStatus = 3;
                    model.UseDays       = (model.EndTime - model.AcceptTime).Days;
                    model.WarningDays   = (DateTime.Now - model.CompleteTime).Days;
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 8
0
        public static List <ReplyEntity> GetTaskReplys(string guid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            List <ReplyEntity> list = new List <ReplyEntity>();

            DataSet   ds          = ReplyDAL.BaseProvider.GetTaskReplys(guid, pageSize, pageIndex, ref totalCount, ref pageCount);
            DataTable replys      = ds.Tables["Replys"];
            DataTable attachments = ds.Tables["Attachments"];

            foreach (DataRow dr in replys.Rows)
            {
                ReplyEntity model = new ReplyEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserCacheByUserID(model.CreateUserID, model.ClientID);
                if (!string.IsNullOrEmpty(model.FromReplyID))
                {
                    model.FromReplyUser = OrganizationBusiness.GetUserCacheByUserID(model.FromReplyUserID, model.FromReplyAgentID);
                }

                model.Attachments = new List <Attachment>();
                if (attachments.Rows.Count > 0)
                {
                    foreach (DataRow dr2 in attachments.Select(" Guid='" + model.ReplyID + "'"))
                    {
                        Attachment attachment = new Attachment();
                        attachment.FillData(dr2);

                        model.Attachments.Add(attachment);
                    }
                }
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 9
0
        public OrderStageEntity GetOrderStageByID(string stageid, string processid, string clientid)
        {
            if (string.IsNullOrEmpty(stageid) || string.IsNullOrEmpty(processid))
            {
                return(null);
            }
            var list = GetOrderStages(processid, clientid);

            if (list.Where(m => m.StageID == stageid).Count() > 0)
            {
                return(list.Where(m => m.StageID == stageid).FirstOrDefault());
            }

            OrderStageEntity model = new OrderStageEntity();
            DataSet          ds    = SystemDAL.BaseProvider.GetOrderStageByID(stageid);

            if (ds.Tables["Stages"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Stages"].Rows[0]);
                model.Owner     = OrganizationBusiness.GetUserByUserID(model.OwnerID, clientid);
                model.StageItem = new List <StageItemEntity>();
                foreach (DataRow itemdr in ds.Tables["Items"].Rows)
                {
                    StageItemEntity item = new StageItemEntity();
                    item.FillData(itemdr);
                    model.StageItem.Add(item);
                }
                OrderStages[clientid].Add(model);
            }

            return(model);
        }
Ejemplo n.º 10
0
        public static List <GoodsDoc> GetGoodsDocByOrderID(string orderid, string taskid, EnumDocType type, string clientid)
        {
            DataSet ds = StockDAL.BaseProvider.GetGoodsDocByOrderID(orderid, taskid, (int)type, clientid);

            List <GoodsDoc> list = new List <GoodsDoc>();

            foreach (DataRow dr in ds.Tables["Doc"].Rows)
            {
                GoodsDoc model = new GoodsDoc();
                model.FillData(dr);
                if (!string.IsNullOrEmpty(model.ExpressID))
                {
                    model.Express = ExpressCompanyBusiness.GetExpressCompanyDetail(model.ExpressID);
                }
                model.CreateUser = OrganizationBusiness.GetUserCacheByUserID(model.CreateUserID, clientid);
                if (!string.IsNullOrEmpty(model.OwnerID))
                {
                    model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, clientid);
                }
                model.Details = new List <GoodsDocDetail>();
                if (ds.Tables.Contains("Details"))
                {
                    foreach (DataRow detail in ds.Tables["Details"].Select("DocID='" + model.DocID + "'"))
                    {
                        GoodsDocDetail goodsDetailModel = new GoodsDocDetail();
                        goodsDetailModel.FillData(detail);
                        model.Details.Add(goodsDetailModel);
                    }
                }
                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 11
0
        public static List <StorageDoc> GetStorageDocList(string userid, EnumDocType type, EnumDocStatus status, string keywords, string begintime, string endtime, string wareid, string providerid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID)
        {
            DataSet ds = StockDAL.GetStorageDocList(userid, (int)type, (int)status, keywords, begintime, endtime, wareid, providerid, pageSize, pageIndex, ref totalCount, ref pageCount, clientID);

            List <StorageDoc> list = new List <StorageDoc>();

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                StorageDoc model = new StorageDoc();
                model.FillData(dr);
                model.UserName  = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID).Name;
                model.StatusStr = GetDocStatusStr(model.DocType, model.Status);

                model.Details = new List <StorageDetail>();
                if (ds.Tables.Contains("Details"))
                {
                    foreach (DataRow detail in ds.Tables["Details"].Select("DocID='" + model.DocID + "'"))
                    {
                        StorageDetail dModel = new StorageDetail();
                        dModel.FillData(detail);
                        if ((int)type == 3 || (int)type == 4)
                        {
                            if (!string.IsNullOrEmpty(dModel.DepotID) && !string.IsNullOrEmpty(dModel.WareID))
                            {
                                dModel.DepotCode = SystemBusiness.BaseBusiness.GetDepotByID(dModel.DepotID, dModel.WareID, clientID).DepotCode;
                            }
                        }
                        model.Details.Add(dModel);
                    }
                }

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 12
0
        public List <OrderStageEntity> GetOrderStages(string processid, string clientid)
        {
            if (OrderStages.ContainsKey(processid))
            {
                return(OrderStages[processid].OrderBy(m => m.Sort).ToList());
            }

            var model = GetOrderProcessByID(processid, clientid);

            List <OrderStageEntity> list = new List <OrderStageEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOrderStages(processid);

            foreach (DataRow dr in ds.Tables["Stages"].Rows)
            {
                OrderStageEntity item = new OrderStageEntity();
                item.FillData(dr);

                item.MarkEntity = GetCategoryItemByMark(model.CategoryID, item.Mark, clientid);

                item.Owner = OrganizationBusiness.GetUserByUserID(item.OwnerID, clientid);
                list.Add(item);
            }
            OrderStages.Add(processid, list);

            return(list);
        }
Ejemplo n.º 13
0
        public static TaskEntity GetTaskByID(string taskid)
        {
            TaskEntity model = new TaskEntity();
            DataTable  dt    = TaskDAL.BaseProvider.GetTaskByID(taskid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);
            }
            return(model);
        }
Ejemplo n.º 14
0
        public bool UpdateCustomerOwner(string customerid, string userid, string operateid, string ip, string clientid)
        {
            bool bl = CustomDAL.BaseProvider.UpdateCustomerOwner(customerid, userid, operateid, clientid);

            if (bl)
            {
                var    model = OrganizationBusiness.GetUserByUserID(userid, clientid);
                string msg   = "客户负责人更换为:" + model.Name;
                LogBusiness.AddLog(customerid, EnumLogObjectType.Customer, msg, operateid, ip, userid, clientid);
            }
            return(bl);
        }
Ejemplo n.º 15
0
        public List <UserWorkLoadRptEntity> GetUserLoadReport(string begintime, string endtime, string userid, string teamid, string clientid)
        {
            DataTable dt = UserRPTDAL.BaseProvider.GetUserLoadReport(begintime, endtime, userid, teamid, clientid);

            List <UserWorkLoadRptEntity> list = new List <UserWorkLoadRptEntity>();

            foreach (DataRow dr in dt.Rows)
            {
                UserWorkLoadRptEntity model = new UserWorkLoadRptEntity();
                model.FillData(dr);
                model.UserName = OrganizationBusiness.GetUserCacheByUserID(model.UserID, clientid).Name;
                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 16
0
        public static List <TaskEntity> GetTasksByYXOrderID(string yxOrderID)
        {
            List <TaskEntity> list = new List <TaskEntity>();
            DataTable         dt   = TaskDAL.BaseProvider.GetTasksByYXOrderID(yxOrderID);

            foreach (DataRow dr in dt.Rows)
            {
                TaskEntity model = new TaskEntity();
                model.FillData(dr);
                model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);

                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 17
0
        public bool DeleteTeam(string teamid, string userid, string ip, string clientid)
        {
            bool bl = SystemDAL.BaseProvider.DeleteTeam(teamid, userid);

            if (bl)
            {
                var model = GetTeamByID(teamid, clientid);
                var list  = OrganizationBusiness.GetUsers(clientid).Where(m => m.TeamID == teamid).ToList();
                foreach (var user in list)
                {
                    user.TeamID = "";
                }
                Teams[clientid].Remove(model);
            }
            return(bl);
        }
Ejemplo n.º 18
0
        /// <summary>
        /// 更新任务成员权限
        /// </summary>
        public static bool UpdateMemberPermission(string taskID, string memberID, TaskMemberPermissionType taskMemberPermissionType, string operateid, string ip, string clientid)
        {
            bool flag = TaskDAL.BaseProvider.UpdateMemberPermission(taskID, memberID, (int)taskMemberPermissionType);

            if (flag)
            {
                var userName = string.Empty;
                var user     = OrganizationBusiness.GetUserByUserID(memberID, clientid);
                userName += user != null ? user.Name : "";

                string msg = "将任务成员" + userName.Trim(',') + "的权限更新为:" + (taskMemberPermissionType == TaskMemberPermissionType.See?"查看":"编辑");
                LogBusiness.AddLog(taskID, EnumLogObjectType.OrderTask, msg, operateid, ip, "", clientid);
            }

            return(flag);
        }
Ejemplo n.º 19
0
        /// <summary>
        /// 移除任务成员
        /// </summary>
        /// <param name="taskID"></param>
        /// <param name="memberID"></param>
        /// <param name="operateid"></param>
        /// <param name="ip"></param>
        /// <param name="clientid"></param>
        /// <returns></returns>
        public static bool RemoveTaskMember(string taskID, string memberID, string operateid, string ip, string clientid)
        {
            bool flag = TaskDAL.BaseProvider.RemoveTaskMember(taskID, memberID);

            if (flag)
            {
                var userName = string.Empty;
                var user     = OrganizationBusiness.GetUserByUserID(memberID, clientid);
                userName += user != null ? user.Name : "";

                string msg = "删除任务成员" + userName.Trim(',');
                LogBusiness.AddLog(taskID, EnumLogObjectType.OrderTask, msg, operateid, ip, "", clientid);
            }

            return(flag);
        }
Ejemplo n.º 20
0
        /// <summary>
        /// 修改任务负责人
        /// </summary>
        /// <param name="taskID"></param>
        /// <param name="OwnerID"></param>
        /// <returns></returns>
        public static bool UpdateTaskOwner(string taskID, string ownerID, string operateid, string operateName, string ip, string clientid, out int result)
        {
            bool flag = TaskDAL.BaseProvider.UpdateTaskOwner(taskID, ownerID, out result);

            if (flag)
            {
                var    user = OrganizationBusiness.GetUserByUserID(ownerID, clientid);
                string msg  = "将任务负责人更改为:" + (user != null?user.Name:ownerID);
                LogBusiness.AddLog(taskID, EnumLogObjectType.OrderTask, msg, operateid, ip, "", clientid);

                //任务更换负责人推送通知
                WeiXinMPPush.BasePush.SendChangeTaskOwnerPush(taskID, operateName);
            }

            return(flag);
        }
Ejemplo n.º 21
0
        public CustomerEntity GetCustomerByID(string customerid, string clientid)
        {
            DataSet        ds    = CustomDAL.BaseProvider.GetCustomerByID(customerid, clientid);
            CustomerEntity model = new CustomerEntity();

            if (ds.Tables["Customer"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Customer"].Rows[0]);
                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.ClientID);

                model.City = CommonBusiness.Citys.Where(m => m.CityCode == model.CityCode).FirstOrDefault();

                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.ClientID);
            }
            return(model);
        }
Ejemplo n.º 22
0
        public List <BillingPay> GetOrderPays(string orderid)
        {
            List <BillingPay> list = new List <BillingPay>();
            DataTable         dt   = FinanceDAL.BaseProvider.GetOrderPays(orderid);

            foreach (DataRow dr in dt.Rows)
            {
                BillingPay model = new BillingPay();
                model.FillData(dr);
                model.PayTypeStr = CommonBusiness.GetEnumDesc <EnumOrderPayType>((EnumOrderPayType)model.PayType);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.ClientID);
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 23
0
        public List <ClientAccountsEntity> GetAccountBills(int mark, string begintime, string endtime, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string clientid)
        {
            List <ClientAccountsEntity> list = new List <ClientAccountsEntity>();
            DataSet ds = FinanceDAL.BaseProvider.GetAccountBills(mark, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                ClientAccountsEntity model = new ClientAccountsEntity();
                model.FillData(dr);

                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.ClientID);

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 24
0
        public string CreateOrderStage(string name, int sort, int mark, int hours, string pid, string processid, string userid, string clientid, out int result)
        {
            string stageid = Guid.NewGuid().ToString();

            bool bl = SystemDAL.BaseProvider.CreateOrderStage(stageid, name, sort, mark, hours, pid, processid, userid, clientid, out result);

            if (bl)
            {
                if (!OrderStages.ContainsKey(processid))
                {
                    GetOrderStages(processid, clientid);
                }
                else
                {
                    var list = OrderStages[processid].Where(m => m.Sort >= sort && m.Status == 1).ToList();

                    foreach (var model in list)
                    {
                        model.Sort += 1;
                    }

                    var Process = GetOrderProcessByID(processid, clientid);

                    OrderStages[processid].Add(new OrderStageEntity()
                    {
                        StageID    = stageid.ToLower(),
                        StageName  = name,
                        Sort       = sort,
                        PID        = pid,
                        Mark       = mark,
                        MaxHours   = hours,
                        MarkEntity = GetCategoryItemByMark(Process.CategoryID, mark, clientid),
                        Status     = 1,
                        CreateTime = DateTime.Now,
                        ProcessID  = processid,
                        OwnerID    = userid,
                        StageItem  = new List <StageItemEntity>(),
                        Owner      = OrganizationBusiness.GetUserByUserID(userid, clientid),
                        ClientID   = clientid
                    });
                }

                return(stageid);
            }
            return("");
        }
Ejemplo n.º 25
0
        public List <ContactEntity> GetContactsByCustomerID(string customerid, string clientid)
        {
            List <ContactEntity> list = new List <ContactEntity>();

            DataTable dt = CustomDAL.BaseProvider.GetContactsByCustomerID(customerid);

            foreach (DataRow dr in dt.Rows)
            {
                ContactEntity model = new ContactEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.ClientID);
                model.City       = CommonBusiness.Citys.Where(m => m.CityCode == model.CityCode).FirstOrDefault();
                list.Add(model);
            }

            return(list);
        }
Ejemplo n.º 26
0
        public static TaskEntity GetTaskDetail(string taskID)
        {
            TaskEntity model = null;
            DataSet    ds    = TaskDAL.BaseProvider.GetTaskDetail(taskID);

            DataTable taskTB = ds.Tables["OrderTask"];

            if (taskTB.Rows.Count > 0)
            {
                model = new TaskEntity();
                model.FillData(taskTB.Rows[0]);
                model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);

                //成员
                DataTable memberTB = ds.Tables["TaskMember"];
                model.TaskMembers = new List <IntFactoryEntity.Task.TaskMember>();
                if (memberTB.Rows.Count > 0)
                {
                    foreach (DataRow m in memberTB.Rows)
                    {
                        TaskMember member = new TaskMember();
                        member.FillData(m);
                        member.Member = OrganizationBusiness.GetUserCacheByUserID(member.MemberID, model.ClientID);
                        model.TaskMembers.Add(member);
                    }
                }

                //订单基本信息
                model.Order = new OrderEntity();
                model.Order.FillData(ds.Tables["Order"].Rows[0]);
                if (!string.IsNullOrEmpty(model.Order.BigCategoryID))
                {
                    var category = SystemBusiness.BaseBusiness.GetProcessCategoryByID(model.Order.BigCategoryID);
                    model.Order.ProcessCategoryName = category == null ? "" : category.Name;
                }
                if (!string.IsNullOrEmpty(model.Order.CategoryID))
                {
                    var category  = ProductsBusiness.BaseBusiness.GetCategoryByID(model.Order.CategoryID);
                    var pcategory = ProductsBusiness.BaseBusiness.GetCategoryByID(category.PID);
                    model.Order.CategoryName = pcategory.CategoryName + " > " + category.CategoryName;
                }
            }

            return(model);
        }
Ejemplo n.º 27
0
        public List <CustomerEntity> GetCustomers(EnumSearchType searchtype, int type, int sourcetype, string sourceid, string stageid, int status, int mark, string searchuserid, string searchteamid,
                                                  string begintime, string endtime, string firstname, string keyWords, string orderBy, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string clientid)
        {
            List <CustomerEntity> list = new List <CustomerEntity>();
            DataSet ds = CustomDAL.BaseProvider.GetCustomers((int)searchtype, type, sourcetype, sourceid, stageid, status, mark, searchuserid, searchteamid, begintime, endtime, firstname, keyWords, orderBy, pageSize, pageIndex, ref totalCount, ref pageCount, userid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                CustomerEntity model = new CustomerEntity();
                model.FillData(dr);

                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.ClientID);
                model.City  = CommonBusiness.Citys.Where(m => m.CityCode == model.CityCode).FirstOrDefault();

                list.Add(model);
            }
            return(list);
        }
Ejemplo n.º 28
0
        public bool UpdateOrderStageOwner(string stageid, string processid, string ownerid, string userid, string ip, string clientid)
        {
            var model = GetOrderStageByID(stageid, processid, clientid);

            if (ownerid == model.OwnerID)
            {
                return(true);
            }

            bool bl = SystemDAL.BaseProvider.UpdateOrderStageOwner(stageid, ownerid);

            if (bl)
            {
                model.OwnerID = ownerid;
                model.Owner   = OrganizationBusiness.GetUserByUserID(ownerid, clientid);
            }
            return(bl);
        }
Ejemplo n.º 29
0
        public bool UpdateOrderProcessOwner(string processid, string ownerid, string userid, string ip, string clientid)
        {
            var model = GetOrderProcessByID(processid, clientid);

            if (ownerid == model.OwnerID)
            {
                return(true);
            }

            bool bl = SystemDAL.BaseProvider.UpdateOrderProcessOwner(processid, ownerid);

            if (bl)
            {
                model.OwnerID   = ownerid;
                model.Owner     = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, clientid);
                model.OwnerName = model.Owner.Name;
            }
            return(bl);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 批量添加任务成员
        /// </summary>
        /// <param name="taskID"></param>
        /// <param name="memberIDs"></param>
        /// <param name="operateid"></param>
        /// <param name="ip"></param>
        /// <param name="clientid"></param>
        /// <returns></returns>
        public static bool AddTaskMembers(string taskID, string memberIDs, string operateid, string ip, string clientid, out int result)
        {
            memberIDs = memberIDs.Trim(',');
            bool flag = TaskDAL.BaseProvider.AddTaskMembers(taskID, memberIDs, operateid, out result);

            if (flag)
            {
                var userName = string.Empty;
                foreach (var m in memberIDs.Split(','))
                {
                    var user = OrganizationBusiness.GetUserByUserID(m, clientid);
                    userName += (user != null ? user.Name : "") + ",";
                }
                string msg = "添加任务成员" + userName.Trim(',');
                LogBusiness.AddLog(taskID, EnumLogObjectType.OrderTask, msg, operateid, ip, "", clientid);
            }

            return(flag);
        }
 /// <summary>
 /// 删除部门
 /// </summary>
 /// <param name="departid"></param>
 /// <returns></returns>
 public JsonResult DeleteDepartment(string departid)
 {
     var status = new OrganizationBusiness().UpdateDepartmentStatus(departid, IntFactoryEnum.EnumStatus.Delete, CurrentUser.UserID, OperateIP, CurrentUser.AgentID);
     JsonDictionary.Add("status", (int)status);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
        /// <summary>
        /// 保存角色
        /// </summary>
        /// <param name="entity"></param>
        /// <returns></returns>
        public JsonResult SaveRole(string entity)
        {
            JavaScriptSerializer serializer = new JavaScriptSerializer();
            Role model = serializer.Deserialize<Role>(entity);

            if (string.IsNullOrEmpty(model.RoleID))
            {
                model.RoleID = new OrganizationBusiness().CreateRole(model.Name, model.ParentID, model.Description, CurrentUser.UserID, CurrentUser.AgentID, CurrentUser.ClientID);
            }
            else
            {
                bool bl = new OrganizationBusiness().UpdateRole(model.RoleID, model.Name, model.Description, CurrentUser.UserID, OperateIP, CurrentUser.AgentID);
                if (!bl)
                {
                    model.RoleID = "";
                }
            }
            JsonDictionary.Add("model", model);
            return new JsonResult
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
 /// <summary>
 /// 保存角色权限
 /// </summary>
 /// <param name="roleid"></param>
 /// <param name="permissions"></param>
 /// <returns></returns>
 public JsonResult SaveRolePermission(string roleid, string permissions)
 {
     if (permissions.Length > 0)
     {
         permissions = permissions.Substring(0, permissions.Length - 1);
        
     }
     bool bl = new OrganizationBusiness().UpdateRolePermission(roleid, permissions, CurrentUser.UserID, OperateIP);
     JsonDictionary.Add("status", bl);
     return new JsonResult
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
        //编辑员工角色
        public JsonResult UpdateUserRole(string userid,string roleid)
        {
            bool bl = new OrganizationBusiness().UpdateUserRole(userid, roleid, CurrentUser.AgentID, CurrentUser.UserID, OperateIP);

            JsonDictionary.Add("status", bl);
            return new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }
 /// <summary>
 /// 删除员工
 /// </summary>
 /// <param name="userid"></param>
 /// <returns></returns>
 public JsonResult DeleteUserByID(string userid)
 {
     int result = 0;
     bool bl = new OrganizationBusiness().DeleteUserByID(userid, CurrentUser.AgentID, CurrentUser.UserID, OperateIP, out result);
     
     JsonDictionary.Add("status", bl);
     return new JsonResult()
     {
         Data = JsonDictionary,
         JsonRequestBehavior = JsonRequestBehavior.AllowGet
     };
 }
        /// <summary>
        /// 组织架构替换人员
        /// </summary>
        /// <param name="userid"></param>
        /// <param name="olduserid"></param>
        /// <returns></returns>
        public JsonResult ChangeUsersParentID(string userid, string olduserid)
        {

            bool bl = new OrganizationBusiness().ChangeUsersParentID(userid, olduserid, CurrentUser.AgentID, CurrentUser.UserID, OperateIP);
           
            JsonDictionary.Add("status", bl);
            return new JsonResult()
            {
                Data = JsonDictionary,
                JsonRequestBehavior = JsonRequestBehavior.AllowGet
            };
        }