예제 #1
0
        public static StorageDoc GetStorageDetail(string docid, string clientid)
        {
            DataSet    ds    = StockDAL.GetStorageDetail(docid, clientid);
            StorageDoc model = new StorageDoc();

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

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

                model.WareHouse = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID);
                model.Details   = new List <StorageDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    StorageDetail details = new StorageDetail();
                    details.FillData(item);
                    model.Details.Add(details);
                }
            }

            return(model);
        }
예제 #2
0
파일: LogBusiness.cs 프로젝트: GitMr/YXERP
        /// <summary>
        /// 获取日志
        /// </summary>
        /// <returns></returns>
        public static List <LogEntity> GetLogs(string guid, EnumLogObjectType type, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string agentid)
        {
            string tablename = "";

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

            case EnumLogObjectType.Orders:
                tablename = "OrdersLog";
                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.GetUserByUserID(model.CreateUserID, model.AgentID);

                list.Add(model);
            }
            return(list);
        }
예제 #3
0
        public OrderTypeEntity GetOrderTypeByID(string typeid, string agentid, string clientid)
        {
            if (string.IsNullOrEmpty(typeid))
            {
                return(null);
            }
            var list = GetOrderTypes(agentid, clientid);

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

            OrderTypeEntity model = new OrderTypeEntity();
            DataTable       dt    = SystemDAL.BaseProvider.GetOrderTypeByID(typeid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                OrderTypes[clientid].Add(model);
            }

            return(model);
        }
예제 #4
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 agentid, 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, agentid, clientid);

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

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

                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);
        }
예제 #5
0
        public string CreateOrderType(string typename, string typecode, string userid, string agentid, string clientid)
        {
            string typeid = Guid.NewGuid().ToString();

            bool bl = SystemDAL.BaseProvider.CreateOrderType(typeid, typename, typecode, userid, clientid);

            if (bl)
            {
                if (!OrderTypes.ContainsKey(clientid))
                {
                    GetOrderTypes(agentid, clientid);
                }

                OrderTypes[clientid].Add(new OrderTypeEntity()
                {
                    TypeID       = typeid.ToLower(),
                    TypeName     = typename,
                    TypeCode     = typecode,
                    Status       = 1,
                    CreateTime   = DateTime.Now,
                    CreateUserID = userid,
                    CreateUser   = OrganizationBusiness.GetUserByUserID(userid, agentid),
                    ClientID     = clientid
                });

                return(typeid);
            }
            return("");
        }
예제 #6
0
        /// <summary>
        /// 获取属性列表(包括属性值列表)
        /// </summary>
        public List <ProductAttr> GetAttrList(string categoryid, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string agentid, string clientid)
        {
            var     dal = new ProductsDAL();
            DataSet ds  = dal.GetAttrList(categoryid, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, clientid);

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

            if (ds.Tables.Contains("Attrs"))
            {
                foreach (DataRow dr in ds.Tables["Attrs"].Rows)
                {
                    ProductAttr model = new ProductAttr();
                    model.FillData(dr);
                    model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);

                    List <AttrValue> valueList = new List <AttrValue>();
                    foreach (DataRow drValue in ds.Tables["Values"].Select("AttrID='" + model.AttrID + "'"))
                    {
                        AttrValue valueModel = new AttrValue();
                        valueModel.FillData(drValue);
                        valueList.Add(valueModel);
                    }
                    model.AttrValues = valueList;

                    list.Add(model);
                }
            }
            return(list);
        }
예제 #7
0
        public string CreateOpportunityStage(string stagename, decimal probability, string userid, string agentid, string clientid)
        {
            string guid = Guid.NewGuid().ToString();

            bool bl = SystemDAL.BaseProvider.CreateOpportunityStage(guid, stagename, probability, userid, clientid);

            if (bl)
            {
                if (!OpportunityStages.ContainsKey(clientid))
                {
                    GetOpportunityStages(agentid, clientid);
                }

                OpportunityStages[clientid].Add(new OpportunityStageEntity()
                {
                    StageID      = guid.ToLower(),
                    StageName    = stagename,
                    Probability  = probability,
                    Status       = 1,
                    CreateTime   = DateTime.Now,
                    CreateUserID = userid,
                    CreateUser   = OrganizationBusiness.GetUserByUserID(userid, agentid),
                    ClientID     = clientid
                });

                return(guid);
            }
            return("");
        }
예제 #8
0
        public string CreateCustomSource(string sourcecode, string sourcename, int ischoose, string userid, string agentid, string clientid, out int result)
        {
            string sourceid = Guid.NewGuid().ToString();

            bool bl = SystemDAL.BaseProvider.CreateCustomSource(sourceid, sourcecode, sourcename, ischoose, userid, clientid, out result);

            if (bl)
            {
                if (!CustomSources.ContainsKey(clientid))
                {
                    GetCustomSources(agentid, clientid);
                }

                CustomSources[clientid].Add(new CustomSourceEntity()
                {
                    SourceID     = sourceid.ToLower(),
                    SourceName   = sourcename,
                    SourceCode   = sourcecode,
                    IsChoose     = ischoose,
                    IsSystem     = 0,
                    Status       = 1,
                    CreateTime   = DateTime.Now,
                    CreateUserID = userid,
                    CreateUser   = OrganizationBusiness.GetUserByUserID(userid, agentid),
                    ClientID     = clientid
                });

                return(sourceid);
            }
            return("");
        }
예제 #9
0
        public List <OrderEntity> GetOrders(EnumSearchType searchtype, string typeid, int status, int paystatus, int invoicestatus, int returnstatus, string searchuserid, string searchteamid, string searchagentid,
                                            string begintime, string endtime, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string agentid, string clientid)
        {
            List <OrderEntity> list = new List <OrderEntity>();
            DataSet            ds   = OrdersDAL.BaseProvider.GetOrders((int)searchtype, typeid, status, paystatus, invoicestatus, returnstatus, searchuserid, searchteamid, searchagentid, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, agentid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                OrderEntity model = new OrderEntity();
                model.FillData(dr);
                model.OrderType = SystemBusiness.BaseBusiness.GetOrderTypeByID(model.TypeID, model.AgentID, model.ClientID);
                model.Owner     = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);

                model.StatusStr = CommonBusiness.GetEnumDesc((EnumOrderStatus)model.Status);
                if (model.Status == 2)
                {
                    model.SendStatusStr = CommonBusiness.GetEnumDesc((EnumSendStatus)model.SendStatus);
                }
                else if (model.Status < 2)
                {
                    model.SendStatusStr = "--";
                }
                list.Add(model);
            }
            return(list);
        }
예제 #10
0
        public bool UpdateCustomerOwner(string customerid, string userid, string operateid, string ip, string agentid, string clientid)
        {
            bool bl = CustomDAL.BaseProvider.UpdateCustomerOwner(customerid, userid, operateid, agentid, clientid);

            if (bl)
            {
                var    model = OrganizationBusiness.GetUserByUserID(userid, agentid);
                string msg   = "客户拥有者更换为:" + model.Name;
                LogBusiness.AddLog(customerid, EnumLogObjectType.Customer, msg, operateid, ip, userid, agentid, clientid);
            }
            return(bl);
        }
예제 #11
0
        public static List <StorageDocAction> GetStorageDocAction(string docid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string agentid)
        {
            DataTable dt = CommonBusiness.GetPagerData("StorageDocAction", "*", "DocID='" + docid + "'", "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

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

            foreach (DataRow dr in dt.Rows)
            {
                StorageDocAction model = new StorageDocAction();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);

                list.Add(model);
            }
            return(list);
        }
예제 #12
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 agentid, string clientid)
        {
            List <ClientAccountsEntity> list = new List <ClientAccountsEntity>();
            DataSet ds = FinanceDAL.BaseProvider.GetAccountBills(mark, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, agentid, clientid);

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

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

                list.Add(model);
            }
            return(list);
        }
예제 #13
0
        public List <OrderEntity> GetOpportunityaByCustomerID(string customerid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string agentid, string clientid)
        {
            List <OrderEntity> list = new List <OrderEntity>();
            DataTable          dt   = CommonBusiness.GetPagerData("Orders", "*", "CustomerID='" + customerid + "' and Status =0 ", "AutoID", pageSize, pageIndex, out totalCount, out pageCount, false);

            foreach (DataRow dr in dt.Rows)
            {
                OrderEntity model = new OrderEntity();
                model.FillData(dr);
                model.Owner = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Stage = SystemBusiness.BaseBusiness.GetOpportunityStageByID(model.StageID, model.AgentID, model.ClientID);

                list.Add(model);
            }
            return(list);
        }
예제 #14
0
        public List <CustomerEntity> GetCustomersByKeywords(string keywords, string userid, string agentid, string clientid)
        {
            List <CustomerEntity> list = new List <CustomerEntity>();
            DataSet ds = CustomDAL.BaseProvider.GetCustomersByKeywords(keywords, userid, agentid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                CustomerEntity model = new CustomerEntity();
                model.FillData(dr);
                model.Owner  = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Source = SystemBusiness.BaseBusiness.GetCustomSourcesByID(model.SourceID, model.AgentID, model.ClientID);
                model.Stage  = SystemBusiness.BaseBusiness.GetCustomStageByID(model.StageID, model.AgentID, model.ClientID);
                list.Add(model);
            }
            return(list);
        }
예제 #15
0
        public List <ContactEntity> GetContactsByCustomerID(string customerid, string agentid)
        {
            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.AgentID);
                model.City       = CommonBusiness.Citys.Where(m => m.CityCode == model.CityCode).FirstOrDefault();
                list.Add(model);
            }

            return(list);
        }
예제 #16
0
        /// <summary>
        /// 获取单据列表
        /// </summary>
        /// <param name="userid">创建人(拥有者)</param>
        /// <param name="type">类型</param>
        /// <param name="status">状态</param>
        /// <param name="keywords">关键词</param>
        /// <param name="pageSize">页Size</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="totalCount">总数</param>
        /// <param name="pageCount"><总页/param>
        /// <param name="clientID">客户端ID</param>
        /// <returns></returns>
        public static List <StorageDoc> GetStorageDocList(string userid, EnumDocType type, EnumDocStatus status, string keywords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientID)
        {
            DataSet ds = OrdersDAL.GetStorageDocList(userid, (int)type, (int)status, keywords, 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.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);

                list.Add(model);
            }
            return(list);
        }
예제 #17
0
        public List <OrderEntity> GetOpportunitys(EnumSearchType searchtype, string typeid, string stageid, string searchuserid, string searchteamid, string searchagentid,
                                                  string begintime, string endtime, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string agentid, string clientid)
        {
            List <OrderEntity> list = new List <OrderEntity>();
            DataSet            ds   = OrdersDAL.BaseProvider.GetOpportunitys((int)searchtype, typeid, stageid, searchuserid, searchteamid, searchagentid, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, agentid, clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                OrderEntity model = new OrderEntity();
                model.FillData(dr);
                model.OrderType = SystemBusiness.BaseBusiness.GetOrderTypeByID(model.TypeID, model.AgentID, model.ClientID);
                model.Stage     = SystemBusiness.BaseBusiness.GetOpportunityStageByID(model.StageID, model.AgentID, model.ClientID);
                model.Owner     = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);

                list.Add(model);
            }
            return(list);
        }
예제 #18
0
        /// <summary>
        /// 根据活动ID获取活动
        /// </summary>
        /// <param name="activityid"></param>
        /// <returns></returns>
        public static ActivityEntity GetActivityByID(string activityid, string agentid, string clientid)
        {
            ActivityEntity model = new ActivityEntity();
            DataTable      dt    = ActivityDAL.BaseProvider.GetActivityByID(activityid, agentid, clientid);

            if (dt.Rows.Count > 0)
            {
                model.FillData(dt.Rows[0]);

                model.Owner   = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Members = new List <Users>();
                foreach (var id in model.MemberID.Split('|'))
                {
                    model.Members.Add(OrganizationBusiness.GetUserByUserID(id, model.AgentID));
                }
            }
            return(model);
        }
예제 #19
0
        public List <CustomerEntity> GetCustomers(EnumSearchType searchtype, int type, string sourceid, string stageid, int status, int mark, string activityid, string searchuserid, string searchteamid, string searchagentid,
                                                  string begintime, string endtime, string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string userid, string agentid, string clientid)
        {
            List <CustomerEntity> list = new List <CustomerEntity>();
            DataSet ds = CustomDAL.BaseProvider.GetCustomers((int)searchtype, type, sourceid, stageid, status, mark, activityid, searchuserid, searchteamid, searchagentid, begintime, endtime, keyWords, pageSize, pageIndex, ref totalCount, ref pageCount, userid, agentid, clientid);

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

                model.Owner  = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Source = SystemBusiness.BaseBusiness.GetCustomSourcesByID(model.SourceID, model.AgentID, model.ClientID);
                model.Stage  = SystemBusiness.BaseBusiness.GetCustomStageByID(model.StageID, model.AgentID, model.ClientID);
                list.Add(model);
            }
            return(list);
        }
예제 #20
0
        public OrderEntity GetOrderByID(string orderid, string agentid, string clientid)
        {
            DataSet     ds    = OrdersDAL.BaseProvider.GetOrderByID(orderid, agentid, clientid);
            OrderEntity model = new OrderEntity();

            if (ds.Tables["Order"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Order"].Rows[0]);
                model.OrderType  = SystemBusiness.BaseBusiness.GetOrderTypeByID(model.TypeID, model.AgentID, model.ClientID);
                model.Owner      = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);

                model.StatusStr      = CommonBusiness.GetEnumDesc((EnumOrderStatus)model.Status);
                model.ExpressTypeStr = CommonBusiness.GetEnumDesc((EnumExpressType)model.ExpressType);

                if (model.Status == 2)
                {
                    model.SendStatusStr = CommonBusiness.GetEnumDesc((EnumSendStatus)model.SendStatus);
                }
                else if (model.Status < 2)
                {
                    model.SendStatusStr = "--";
                }

                model.City = CommonBusiness.GetCityByCode(model.CityCode);

                if (ds.Tables["Customer"].Rows.Count > 0)
                {
                    model.Customer = new CustomerEntity();
                    model.Customer.FillData(ds.Tables["Customer"].Rows[0]);
                }
                model.Details = new List <OrderDetail>();
                if (ds.Tables["Details"].Rows.Count > 0)
                {
                    foreach (DataRow dr in ds.Tables["Details"].Rows)
                    {
                        OrderDetail detail = new OrderDetail();
                        detail.FillData(dr);
                        model.Details.Add(detail);
                    }
                }
            }
            return(model);
        }
예제 #21
0
        public CustomerEntity GetCustomerByID(string customerid, string agentid, string clientid)
        {
            DataSet        ds    = CustomDAL.BaseProvider.GetCustomerByID(customerid, agentid, 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.AgentID);
                model.Source = SystemBusiness.BaseBusiness.GetCustomSourcesByID(model.SourceID, model.AgentID, model.ClientID);
                model.Stage  = SystemBusiness.BaseBusiness.GetCustomStageByID(model.StageID, model.AgentID, model.ClientID);
                if (model.Extent > 0)
                {
                    model.ExtentStr = GetExtents().Where(m => m.ExtentID == model.Extent.ToString()).FirstOrDefault().ExtentName;
                }

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

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

                if (!string.IsNullOrEmpty(model.IndustryID))
                {
                    model.Industry = Manage.IndustryBusiness.GetIndustryDetail(model.IndustryID);
                }
                if (ds.Tables["Activity"].Rows.Count > 0)
                {
                    model.Activity = new ActivityEntity();
                    model.Activity.FillData(ds.Tables["Activity"].Rows[0]);
                }

                //if (ds.Tables["Contact"].Rows.Count > 0)
                //{
                //    model.Contacts = new List<ContactEntity>();
                //    foreach (DataRow dr in ds.Tables["Contact"].Rows)
                //    {
                //        ContactEntity con = new ContactEntity();
                //        con.FillData(dr);
                //        model.Contacts.Add(con);
                //    }

                //}
            }
            return(model);
        }
예제 #22
0
        /// <summary>
        /// 获取活动列表
        /// </summary>
        /// <param name="userid">负责人</param>
        /// <param name="status">状态</param>
        /// <param name="filterType">过滤类型 0:所有;1:我负责的;2:我参与的</param>
        /// <param name="keyWords">关键词</param>
        /// <param name="beginTime">开始时间</param>
        /// <param name="endTime">结束时间</param>
        /// <param name="pageSize">页Size</param>
        /// <param name="pageIndex">页码</param>
        /// <param name="totalCount">总记录</param>
        /// <param name="pageCount">总页数</param>
        /// <param name="agentid">代理商ID</param>
        /// <param name="clientid">客户端ID</param>
        /// <returns></returns>
        public static List <ActivityEntity> GetActivitys(string userid, EnumActivityStage stage, int filterType, string keyWords, string beginTime, string endTime, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string agentid, string clientid)
        {
            List <ActivityEntity> list = new List <ActivityEntity>();
            DataTable             dt   = ActivityDAL.BaseProvider.GetActivitys(userid, (int)stage, filterType, keyWords, beginTime, endTime, pageSize, pageIndex, ref totalCount, ref pageCount, agentid, clientid);

            foreach (DataRow dr in dt.Rows)
            {
                ActivityEntity model = new ActivityEntity();
                model.FillData(dr);
                model.Owner   = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Members = new List <Users>();
                foreach (var id in model.MemberID.Split('|'))
                {
                    model.Members.Add(OrganizationBusiness.GetUserByUserID(id, model.AgentID));
                }
                list.Add(model);
            }
            return(list);
        }
예제 #23
0
        public List <CustomerEntity> GetCustomersByActivityID(string activityid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            List <CustomerEntity> list = new List <CustomerEntity>();
            string sqlWhere            = " ActivityID='" + activityid + "' and status<>9";

            DataTable dt = CommonBusiness.GetPagerData("Customer", "*", sqlWhere, "CustomerID", pageSize, pageIndex, out totalCount, out pageCount);

            foreach (DataRow dr in dt.Rows)
            {
                CustomerEntity model = new CustomerEntity();
                model.FillData(dr);

                model.Owner  = OrganizationBusiness.GetUserByUserID(model.OwnerID, model.AgentID);
                model.Source = SystemBusiness.BaseBusiness.GetCustomSourcesByID(model.SourceID, model.AgentID, model.ClientID);
                model.Stage  = SystemBusiness.BaseBusiness.GetCustomStageByID(model.StageID, model.AgentID, model.ClientID);
                list.Add(model);
            }
            return(list);
        }
예제 #24
0
        public static List <ReplyEntity> GetReplys(string guid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            List <ReplyEntity> list     = new List <ReplyEntity>();
            string             whereSql = " Status<>9 and GUID='" + guid + "' ";
            DataTable          dt       = CommonBusiness.GetPagerData("CustomerReply", "*", whereSql, "AutoID", "CreateTime desc ", pageSize, pageIndex, out totalCount, out pageCount, false);

            foreach (DataRow dr in dt.Rows)
            {
                ReplyEntity model = new ReplyEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, model.AgentID);
                if (!string.IsNullOrEmpty(model.FromReplyID))
                {
                    model.FromReplyUser = OrganizationBusiness.GetUserByUserID(model.FromReplyUserID, model.FromReplyAgentID);
                }
                list.Add(model);
            }

            return(list);
        }
예제 #25
0
        public List <CustomSourceEntity> GetCustomSources(string agentid, string clientid)
        {
            if (CustomSources.ContainsKey(clientid))
            {
                return(CustomSources[clientid]);
            }

            List <CustomSourceEntity> list = new List <CustomSourceEntity>();
            DataTable dt = SystemDAL.BaseProvider.GetCustomSources(clientid);

            foreach (DataRow dr in dt.Rows)
            {
                CustomSourceEntity model = new CustomSourceEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                list.Add(model);
            }
            CustomSources.Add(clientid, list);

            return(list);
        }
예제 #26
0
        public List <OrderTypeEntity> GetOrderTypes(string agentid, string clientid)
        {
            if (OrderTypes.ContainsKey(clientid))
            {
                return(OrderTypes[clientid].ToList());
            }

            List <OrderTypeEntity> list = new List <OrderTypeEntity>();
            DataSet ds = SystemDAL.BaseProvider.GetOrderTypes(clientid);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                OrderTypeEntity model = new OrderTypeEntity();
                model.FillData(dr);
                model.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, agentid);
                list.Add(model);
            }

            OrderTypes.Add(clientid, list);

            return(list);
        }
예제 #27
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.CreateUser = OrganizationBusiness.GetUserByUserID(model.CreateUserID, clientID);
                model.StatusStr  = GetDocStatusStr(model.DocType, model.Status);
                model.WareHouse  = SystemBusiness.BaseBusiness.GetWareByID(model.WareID, model.ClientID);
                if (!string.IsNullOrEmpty(model.ProviderID))
                {
                    model.ProviderName = BaseBusiness.GetProviderByID(model.ProviderID).Name;
                }

                list.Add(model);
            }
            return(list);
        }
예제 #28
0
        /// <summary>
        /// 获取单据详情
        /// </summary>
        /// <param name="docid">单据ID</param>
        /// <param name="clientid">客户端ID</param>
        /// <returns></returns>
        public static StorageDoc GetStorageDetail(string docid, string clientid)
        {
            DataSet    ds    = OrdersDAL.GetStorageDetail(docid, clientid);
            StorageDoc model = new StorageDoc();

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

                model.Details = new List <StorageDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    StorageDetail details = new StorageDetail();
                    details.FillData(item);
                    model.Details.Add(details);
                }
            }

            return(model);
        }
예제 #29
0
        public bool UpdateUserTeamID(string userid, string teamid, string agentid, string operateid, string ip, string clientid)
        {
            var model = OrganizationBusiness.GetUserByUserID(userid, agentid);

            bool bl = SystemDAL.BaseProvider.UpdateUserTeamID(userid, teamid, operateid, agentid);

            if (bl)
            {
                if (string.IsNullOrEmpty(teamid))
                {
                    var team = GetTeamByID(model.TeamID, agentid);
                    var user = team.Users.Where(m => m.UserID == userid).FirstOrDefault();
                    team.Users.Remove(user);
                }
                else
                {
                    var team = GetTeamByID(teamid, agentid);
                    team.Users.Add(model);
                }

                model.TeamID = teamid;
            }
            return(bl);
        }
예제 #30
0
        public List <StageCustomerEntity> GetUserCustomers(string userid, string teamid, string begintime, string endtime, string agentid, string clientid)
        {
            List <StageCustomerEntity> list = new List <StageCustomerEntity>();

            DataSet ds = CustomerRPTDAL.BaseProvider.GetUserCustomers(userid, teamid, begintime, endtime, agentid, clientid);

            DataTable dt = ds.Tables["Users"];

            var stages = SystemBusiness.BaseBusiness.GetCustomStages(agentid, clientid);



            if (!string.IsNullOrEmpty(userid))
            {
                #region 统计个人

                StageCustomerEntity model = new StageCustomerEntity();
                model.Name   = OrganizationBusiness.GetUserByUserID(userid, agentid).Name;
                model.Stages = new List <StageCustomerItem>();
                foreach (var stage in stages)
                {
                    StageCustomerItem item = new StageCustomerItem();
                    item.Name = stage.StageName;

                    var drs = dt.Select("StageID='" + item.StageID + "'");
                    if (drs.Count() > 0)
                    {
                        item.Count = Convert.ToInt32(drs[0]["Value"]);
                    }
                    else
                    {
                        item.Count = 0;
                    }
                    model.Stages.Add(item);
                }
                list.Add(model);

                #endregion
            }
            else if (!string.IsNullOrEmpty(teamid))
            {
                #region 统计团队
                var team = SystemBusiness.BaseBusiness.GetTeamByID(teamid, agentid);
                StageCustomerEntity model = new StageCustomerEntity();

                model.Name = team.TeamName;
                model.GUID = team.TeamID;

                model.Stages     = new List <StageCustomerItem>();
                model.ChildItems = new List <StageCustomerEntity>();

                //遍历成员
                foreach (var user in team.Users)
                {
                    StageCustomerEntity childModel = new StageCustomerEntity();
                    childModel.GUID   = user.UserID;
                    childModel.Name   = user.Name;
                    childModel.PID    = team.TeamID;
                    childModel.Stages = new List <StageCustomerItem>();

                    //遍历阶段
                    foreach (var stage in stages)
                    {
                        StageCustomerItem childItem = new StageCustomerItem();
                        childItem.Name = stage.StageName;

                        var drs = dt.Select("StageID='" + stage.StageID + "' and OwnerID='" + user.UserID + "'");

                        if (drs.Count() > 0)
                        {
                            childItem.Count = Convert.ToInt32(drs[0]["Value"]);
                        }
                        else
                        {
                            childItem.Count = 0;
                        }

                        if (model.Stages.Where(m => m.StageID == stage.StageID).Count() > 0)
                        {
                            model.Stages.Where(m => m.StageID == stage.StageID).FirstOrDefault().Count += childItem.Count;
                        }
                        else
                        {
                            StageCustomerItem item = new StageCustomerItem();
                            item.Name    = stage.StageName;
                            item.StageID = stage.StageID;
                            item.Count   = childItem.Count;
                            model.Stages.Add(item);
                        }

                        childModel.Stages.Add(childItem);
                    }
                    model.ChildItems.Add(childModel);
                }
                list.Add(model);

                #endregion
            }
            else
            {
                #region 统计所有
                var teams = SystemBusiness.BaseBusiness.GetTeams(agentid);
                foreach (var team in teams)
                {
                    StageCustomerEntity model = new StageCustomerEntity();

                    model.Name = team.TeamName;
                    model.GUID = team.TeamID;

                    model.Stages     = new List <StageCustomerItem>();
                    model.ChildItems = new List <StageCustomerEntity>();

                    //遍历成员
                    foreach (var user in team.Users)
                    {
                        StageCustomerEntity childModel = new StageCustomerEntity();
                        childModel.GUID   = user.UserID;
                        childModel.Name   = user.Name;
                        childModel.PID    = team.TeamID;
                        childModel.Stages = new List <StageCustomerItem>();

                        //遍历阶段
                        foreach (var stage in stages)
                        {
                            StageCustomerItem childItem = new StageCustomerItem();
                            childItem.Name = stage.StageName;

                            var drs = dt.Select("StageID='" + stage.StageID + "' and OwnerID='" + user.UserID + "'");

                            if (drs.Count() > 0)
                            {
                                childItem.Count = Convert.ToInt32(drs[0]["Value"]);
                            }
                            else
                            {
                                childItem.Count = 0;
                            }

                            if (model.Stages.Where(m => m.StageID == stage.StageID).Count() > 0)
                            {
                                model.Stages.Where(m => m.StageID == stage.StageID).FirstOrDefault().Count += childItem.Count;
                            }
                            else
                            {
                                StageCustomerItem item = new StageCustomerItem();
                                item.Name    = stage.StageName;
                                item.StageID = stage.StageID;
                                item.Count   = childItem.Count;
                                model.Stages.Add(item);
                            }

                            childModel.Stages.Add(childItem);
                        }
                        model.ChildItems.Add(childModel);
                    }
                    list.Add(model);
                }

                #endregion
            }


            return(list);
        }