Esempio n. 1
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);
        }
Esempio n. 2
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);
        }
Esempio 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);
        }
Esempio n. 4
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);
        }
Esempio n. 5
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);
        }
Esempio n. 6
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);
        }
Esempio n. 7
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);
        }
Esempio n. 8
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);
        }
Esempio n. 9
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);
        }
Esempio n. 10
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);
        }
Esempio n. 11
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);
        }
Esempio n. 12
0
        public static List <TaskEntity> GetPushTasksForNewOrder(string orderid)
        {
            List <TaskEntity> list = new List <TaskEntity>();
            DataSet           ds   = TaskDAL.BaseProvider.GetPushTasksForNewOrder(orderid);

            if (ds.Tables.Count > 0)
            {
                DataTable taskTB = ds.Tables["OrderTask"];
                foreach (DataRow dr in taskTB.Rows)
                {
                    TaskEntity model = new TaskEntity();
                    model.FillData(dr);
                    model.Owner = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, model.ClientID);

                    list.Add(model);
                }
            }

            return(list);
        }
Esempio n. 13
0
        public OrderProcessEntity GetOrderProcessByID(string processid, string clientid)
        {
            var list = GetOrderProcess(clientid);

            if (list.Where(m => m.ProcessID == processid).Count() > 0)
            {
                return(list.Where(m => m.ProcessID == processid).FirstOrDefault());
            }
            OrderProcessEntity model = new OrderProcessEntity();
            DataTable          dt    = SystemDAL.BaseProvider.GetOrderProcessByID(processid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.Owner        = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, clientid);
                model.OwnerName    = model.Owner.Name;
                model.CategoryName = GetProcessCategoryByID(model.CategoryID).Name;

                list.Add(model);
            }
            return(model);
        }
Esempio n. 14
0
        public List <OrderProcessEntity> GetOrderProcess(string clientid)
        {
            if (OrderProcess.ContainsKey(clientid))
            {
                return(OrderProcess[clientid]);
            }

            List <OrderProcessEntity> list = new List <OrderProcessEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOrderProcess(clientid);

            foreach (DataRow dr in ds.Tables["Stages"].Rows)
            {
                OrderProcessEntity model = new OrderProcessEntity();
                model.FillData(dr);
                model.Owner        = OrganizationBusiness.GetUserCacheByUserID(model.OwnerID, clientid);
                model.OwnerName    = model.Owner.Name;
                model.CategoryName = GetProcessCategoryByID(model.CategoryID).Name;
                list.Add(model);
            }
            OrderProcess.Add(clientid, list);

            return(list);
        }