Exemplo n.º 1
0
 public EnumResultStatus UpdateDepartmentStatus(string departid, EnumStatus status, string operateid, string operateip, string clientid)
 {
     if (status == EnumStatus.Delete)
     {
         object count = CommonBusiness.Select("Users", "count(0)", "DepartID='" + departid + "' and Status=1");
         if (Convert.ToInt32(count) > 0)
         {
             return(EnumResultStatus.Exists);
         }
     }
     if (CommonBusiness.Update("Department", "Status", (int)status, "DepartID='" + departid + "'"))
     {
         var model = GetDepartments(clientid).Where(d => d.DepartID == departid).FirstOrDefault();
         model.Status = (int)status;
         return(EnumResultStatus.Success);
     }
     else
     {
         return(EnumResultStatus.Failed);
     }
 }
Exemplo n.º 2
0
        public List <ProvidersEntity> GetProviders(string keyWords, int pageSize, int pageIndex, ref int totalCount, ref int pageCount, string clientid)
        {
            var dal = new StockDAL();

            string where = " ClientID='" + clientid + "' and Status<>9";
            if (!string.IsNullOrEmpty(keyWords))
            {
                where += " and (Name like '%" + keyWords + "%' or Contact like '%" + keyWords + "%' or MobileTele like '%" + keyWords + "%')";
            }
            DataTable dt = CommonBusiness.GetPagerData("Providers", "*", where, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);

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

            foreach (DataRow dr in dt.Rows)
            {
                ProvidersEntity model = new ProvidersEntity();
                model.FillData(dr);
                model.City = CommonBusiness.Citys.Where(c => c.CityCode == model.CityCode).FirstOrDefault();
                list.Add(model);
            }
            return(list);
        }
Exemplo n.º 3
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);

                if (!string.IsNullOrEmpty(model.ExpressID))
                {
                    model.Express = ExpressCompanyBusiness.GetExpressCompanyDetail(model.ExpressID);
                }

                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);
                    if (!string.IsNullOrEmpty(details.UnitID))
                    {
                        details.UnitName = new ProductsBusiness().GetUnitByID(details.UnitID).UnitName;
                    }
                    if (!string.IsNullOrEmpty(details.ProviderID))
                    {
                        details.Providers = new ProvidersBusiness().GetProviderByID(details.ProviderID);
                    }
                    model.Details.Add(details);
                }
            }

            return(model);
        }
Exemplo n.º 4
0
        public static bool DeleteReply(EnumLogObjectType type, string replyid)
        {
            string tablename = "";

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

            case EnumLogObjectType.OrderTask:
                tablename = "TaskReply";
                break;

            case EnumLogObjectType.Orders:
                tablename = "OrderReply";
                break;
            }

            bool bl = CommonBusiness.Update(tablename, "Status", 9, "ReplyID='" + replyid + "'");

            return(bl);
        }
Exemplo n.º 5
0
        public static List <Users> GetUsers(string keyWords, string departID, string roleID, string clientid, int pageSize, int pageIndex, ref int totalCount, ref int pageCount)
        {
            string whereSql = "ClientID='" + clientid + "' and Status<>9";

            if (!string.IsNullOrEmpty(keyWords))
            {
                whereSql += " and ( Name like '%" + keyWords + "%' or MobilePhone like '%" + keyWords + "%' or Email like '%" + keyWords + "%')";
            }

            if (!string.IsNullOrEmpty(departID))
            {
                whereSql += " and DepartID='" + departID + "'";
            }

            if (!string.IsNullOrEmpty(roleID))
            {
                whereSql += " and RoleID='" + roleID + "'";
            }

            DataTable    dt   = CommonBusiness.GetPagerData("Users", "*", whereSql, "AutoID", pageSize, pageIndex, out totalCount, out pageCount);
            List <Users> list = new List <Users>();
            Users        model;

            foreach (DataRow item in dt.Rows)
            {
                model = new Users();
                model.FillData(item);

                model.CreateUser = GetUserCacheByUserID(model.CreateUserID, model.ClientID);
                model.Department = GetDepartmentByID(model.DepartID, model.ClientID);
                model.Role       = GetRoleByIDCache(model.RoleID, model.ClientID);

                list.Add(model);
            }

            return(list);
        }
Exemplo n.º 6
0
        public bool DeleteContact(string contactid, string ip, string userid)
        {
            bool bl = CommonBusiness.Update("Contact", "Status", 9, "ContactID='" + contactid + "'");

            return(bl);
        }
Exemplo n.º 7
0
        public Task <bool> SendWeiXinMPPush(WeiXinMPPushType pushType, string guid, string operateName = "")
        {
            string result = string.Empty;

            if (pushType == WeiXinMPPushType.SendTaskFinishPush)
            {
                TaskEntity task = TaskBusiness.GetPushTaskForFinishTask(guid);
                if (!string.IsNullOrEmpty(task.OpenID))
                {
                    string content = GetPushContent(pushType, task.OpenID, task.Title,
                                                    task.GoodsName, task.OrderType,
                                                    task.PreTitle, task.Owner.Name, null, task.TaskID, operateName);
                    result = SendPush(content);

                    ApiCloudPush.BasePush.SendPush("您的" + task.Title + "上级任务:" + task.PreTitle + "标记完成", task.OwnerID);
                }
                if (task.Order != null)
                {
                    var order = task.Order;
                    if (!string.IsNullOrEmpty(order.OpenID))
                    {
                        pushType = WeiXinMPPushType.SendAllTaskFinishPush;
                        string content = GetPushContent(pushType, order.OpenID, order.OrderCode,
                                                        task.GoodsName, task.OrderType,
                                                        string.Empty, CommonBusiness.GetEnumDesc((EnumOrderStageStatus)order.Status));
                        result = SendPush(content);
                    }

                    ApiCloudPush.BasePush.SendPush("您的" + task.GoodsName + "所有任务已完成", order.OwnerID);
                }
            }
            else if (pushType == WeiXinMPPushType.SendNewTaskPush)
            {
                List <TaskEntity> tasks = TaskBusiness.GetPushTasksForNewOrder(guid);
                if (tasks.Count > 0)
                {
                    foreach (var task in tasks)
                    {
                        if (!string.IsNullOrEmpty(task.OpenID))
                        {
                            string content = GetPushContent(pushType, task.OpenID, task.Title,
                                                            task.GoodsName, task.OrderType,
                                                            "", "", task.EndTime, task.TaskID);
                            result = SendPush(content);
                        }

                        ApiCloudPush.BasePush.SendPush("您收到了一个新任务:" + task.Title, task.OwnerID);
                    }
                }
            }
            else if (pushType == WeiXinMPPushType.SendChangeOrderOwnerPush)
            {
                TaskEntity task = TaskBusiness.GetPushTaskForChangeOrderOwner(guid);
                if (task != null)
                {
                    if (!string.IsNullOrEmpty(task.OpenID))
                    {
                        string content = GetPushContent(pushType, task.OpenID, task.Title,
                                                        task.GoodsName, task.OrderType,
                                                        "", "", task.EndTime, "", operateName);
                        result = SendPush(content);
                    }

                    ApiCloudPush.BasePush.SendPush(operateName + "将您设为订单:" + task.GoodsName + "的负责人!", task.OwnerID);
                }
            }
            else if (pushType == WeiXinMPPushType.SendChangeTaskOwnerPush)
            {
                TaskEntity task = TaskBusiness.GetPushTaskForChangeTaskOwner(guid);
                if (task != null)
                {
                    if (!string.IsNullOrEmpty(task.OpenID))
                    {
                        string content = GetPushContent(pushType, task.OpenID, task.Title,
                                                        task.GoodsName, task.OrderType,
                                                        "", "", task.EndTime, guid, operateName);
                        result = SendPush(content);
                    }

                    ApiCloudPush.BasePush.SendPush(operateName + "将您设为任务:" + task.Title + "的负责人!", task.OwnerID);
                }
            }

            return(Task.Run(() => { return !string.IsNullOrEmpty(result); }));
        }
Exemplo n.º 8
0
 public bool UpdateProductDetailsStatus(string productdetailid, EnumStatus status, string operateIP, string operateID)
 {
     return(CommonBusiness.Update("ProductDetail", "Status", (int)status, " ProductDetailID='" + productdetailid + "'"));
 }
Exemplo n.º 9
0
 public bool UpdateProductStatus(string productid, EnumStatus status, string operateIP, string operateID)
 {
     return(CommonBusiness.Update("Products", "Status", ((int)status).ToString(), " ProductID='" + productid + "'"));
 }
Exemplo n.º 10
0
        public Products GetProductByIDForDetails(string productid, string clientid)
        {
            var     dal = new ProductsDAL();
            DataSet ds  = dal.GetProductByIDForDetails(productid, clientid);

            Products model = new Products();

            if (ds.Tables.Contains("Product") && ds.Tables["Product"].Rows.Count > 0)
            {
                model.FillData(ds.Tables["Product"].Rows[0]);

                model.SmallUnit = GetUnitByID(model.UnitID);

                model.AttrLists = new List <ProductAttr>();
                model.SaleAttrs = new List <ProductAttr>();

                model.Providers = new ProvidersEntity();
                if (!string.IsNullOrEmpty(model.ProviderID))
                {
                    model.Providers.FillData(ds.Tables["Providers"].Rows[0]);
                    if (!string.IsNullOrEmpty(model.Providers.CityCode))
                    {
                        var city = CommonBusiness.GetCityByCode(model.Providers.CityCode);
                        model.Providers.Address = city.Description + model.Providers.Address;
                    }
                }

                if (!string.IsNullOrEmpty(model.CategoryID))
                {
                    var category = GetCategoryByID(model.CategoryID);
                    foreach (var attr in category.AttrLists)
                    {
                        ProductAttr attrModel = new ProductAttr();
                        attrModel.AttrName   = attr.AttrName;
                        attrModel.AttrValues = new List <AttrValue>();
                        foreach (var value in attr.AttrValues)
                        {
                            if (model.AttrValueList.IndexOf(value.ValueID) >= 0)
                            {
                                attrModel.AttrValues.Add(value);
                                model.AttrLists.Add(attrModel);
                                break;
                            }
                        }
                    }
                    model.SaleAttrs = category.SaleAttrs;
                }

                model.ProductDetails = new List <ProductDetail>();
                foreach (DataRow item in ds.Tables["Details"].Rows)
                {
                    ProductDetail detail = new ProductDetail();
                    detail.FillData(item);
                    detail.DetailStocks = new List <ProductStock>();
                    foreach (var stocktr in ds.Tables["Stocks"].Select("ProductDetailID='" + detail.ProductDetailID + "'"))
                    {
                        ProductStock stock = new ProductStock();
                        stock.FillData(stocktr);
                        detail.DetailStocks.Add(stock);
                    }
                    model.ProductDetails.Add(detail);
                }
            }

            return(model);
        }
Exemplo n.º 11
0
        public bool IsExistProductCode(string code, string clientid)
        {
            object obj = CommonBusiness.Select("Products", " Count(0) ", "ClientID='" + clientid + "' and ProductCode='" + code + "'");

            return(Convert.ToInt32(obj) > 0);
        }
Exemplo n.º 12
0
 public static bool UpdateCartBatch(string autoid, string batch, string userid)
 {
     return(CommonBusiness.Update("ShoppingCart", "BatchCode", batch, "AutoID=" + autoid));
 }
Exemplo n.º 13
0
 public bool UpdateProviderStatus(string providerid, EnumStatus status, string ip, string operateid)
 {
     return(CommonBusiness.Update("Providers", "Status", (int)status, "ProviderID='" + providerid + "'"));
 }