示例#1
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         PaypalAccountType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
示例#2
0
 public JsonResult ToExcel(string search)
 {
     try
     {
         List <OrderPeiRecordType> objList = NSession.CreateQuery("from OrderPeiRecordType " + Utilities.SqlWhere(search))
                                             .List <OrderPeiRecordType>().ToList();
         Session["ExportDown"] = ExcelHelper.GetExcelXml(Utilities.FillDataTable((objList)));
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true, ErrorMsg = "导出成功" }));
 }
 public JsonResult Create(LanguageType obj)
 {
     try
     {
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
         Language.ReLoadLanguage();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         EbayMessageType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { ErrorMsg = "出错了", IsSuccess = false }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
        public void NoAttend(DateTime LastAttend)
        {
            TimeSpan day = DateTime.Now.Date - LastAttend;

            for (int i = 1; i < day.Days; i++)
            {
                AttendType obj = new AttendType()
                {
                    CurrentDate = DateTime.Now.Date.AddDays(-i), UserId = CurrentUser.Id, UserCode = CurrentUser.Code, RealName = CurrentUser.Realname
                };
                NSession.Save(obj);
                NSession.Flush();
            }
        }
        public JsonResult List(int page, int rows, string search)
        {
            string orderby = " order by CurrentDate desc ";

            string where = Utilities.SqlWhere(search);
            IList <AttendType> objList = NSession.CreateQuery("from AttendType " + where + orderby)
                                         .SetFirstResult(rows * (page - 1))
                                         .SetMaxResults(rows)
                                         .List <AttendType>();

            object count = NSession.CreateQuery("select count(Id) from AttendType " + where).UniqueResult();

            return(Json(new { total = count, rows = objList.OrderByDescending(p => p.CurrentDate) }));
        }
示例#7
0
        public JsonResult List(int page, int rows, string sort, string order, string search)
        {
            string orderby = Utilities.OrdeerBy(sort, order);

            string where = Utilities.SqlWhere(search);
            IList <PaypalAccountType> objList = NSession.CreateQuery("from PaypalAccountType" + where + orderby)
                                                .SetFirstResult(rows * (page - 1))
                                                .SetMaxResults(rows * page)
                                                .List <PaypalAccountType>();

            object count = NSession.CreateQuery("select count(Id) from  PaypalAccountType " + where).UniqueResult();

            return(Json(new { total = count, rows = objList }));
        }
示例#8
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         PlacardType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错" + ee.Message }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public JsonResult PrintSKU(int Id)
        {
            PlanDaoType obj = NSession.Get <PlanDaoType>(Id);

            if (obj != null)
            {
                NSession.Flush();
                IList <PurchasePlanType> plans = NSession.CreateQuery("from PurchasePlanType where PlanNo=:p and SKU=:p2").SetString("p", obj.PlanNo).SetString("p2", obj.SKU).SetMaxResults(1).List <PurchasePlanType>();
                PurchasePlanType         plan  = plans[0];
                IList <SKUCodeType>      list  =
                    NSession.CreateQuery("from SKUCodeType where SKU=:p1 and PlanNo=:p2 and Code >=:p3 order by Id").SetString("p1", obj.SKU).
                    SetString("p2", obj.PlanNo).SetInt32("p3", obj.SKUCode).SetMaxResults(obj.RealQty).List <SKUCodeType>();
                DataTable dt = new DataTable();
                dt.Columns.Add("sku");
                dt.Columns.Add("name");
                dt.Columns.Add("num");
                dt.Columns.Add("date");
                dt.Columns.Add("people");
                dt.Columns.Add("desc");
                dt.Columns.Add("code");
                int i = 1;
                foreach (SKUCodeType skuCodeType in list)
                {
                    DataRow dr = dt.NewRow();
                    dr[0] = plan.SKU;
                    dr[1] = plan.ProductName;
                    dr[2] = i + "/" + obj.RealQty;
                    dr[3] = plan.BuyOn;
                    dr[4] = plan.BuyBy;
                    dr[5] = plan.PlanNo;
                    dr[6] = skuCodeType.Code;
                    dt.Rows.Add(dr);
                    i++;
                }
                DataSet ds = new DataSet();
                ds.Tables.Add(dt);
                if (plan.ExpectReceiveOn < (new DateTime(2000, 1, 1)))
                {
                    plan.ExpectReceiveOn = new DateTime(2000, 1, 1);
                }
                PrintDataType data = new PrintDataType();
                data.Content  = ds.GetXml();
                data.CreateOn = DateTime.Now;
                NSession.Save(data);
                NSession.Flush();
                return(Json(new { IsSuccess = true, Result = data.Id }));
            }
            return(Json(new { IsSuccess = false }));
        }
示例#10
0
        public JsonResult Create(ProductType obj)
        {
            try
            {
                string filePath = Server.MapPath("~");
                obj.CreateOn = DateTime.Now;
                string pic = obj.PicUrl;
                if (!string.IsNullOrEmpty(pic))
                {
                    obj.PicUrl  = Utilities.BPicPath + obj.SKU + ".jpg";
                    obj.SPicUrl = Utilities.SPicPath + obj.SKU + ".png";

                    Utilities.DrawImageRectRect(pic, filePath + obj.PicUrl, 310, 310);
                    Utilities.DrawImageRectRect(pic, filePath + obj.SPicUrl, 64, 64);
                }

                List <ProductComposeType> list1 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductComposeType> >(obj.rows);
                if (list1.Count > 0)
                {
                    obj.IsZu = 1;
                }
                obj.Enabled = 1;
                NSession.SaveOrUpdate(obj);
                NSession.Flush();
                foreach (ProductComposeType productCompose in list1)
                {
                    productCompose.SKU = obj.SKU;
                    productCompose.PId = obj.Id;
                    NSession.Save(productCompose);
                    NSession.Flush();
                }
                List <ProductIsInfractionType> list2 = Newtonsoft.Json.JsonConvert.DeserializeObject <List <ProductIsInfractionType> >(obj.rows2);
                foreach (ProductIsInfractionType item in list2)
                {
                    item.OldSKU = obj.OldSKU;
                    item.SKU    = obj.SKU;
                    NSession.Save(item);
                    NSession.Flush();
                }

                AddToWarehouse(obj);
                LoggerUtil.GetProductRecord(obj, "商品创建", "创建一件商品", CurrentUser, NSession);
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
示例#11
0
        public JsonResult List(int page, int rows, string sort, string order, string search, string infraction = "", string c = "")
        {
            string orderby = Utilities.OrdeerBy(sort, order);

            string where = Utilities.SqlWhere(search);
            if (where != "")
            {
                where += " and  Enabled <>0";
            }
            else
            {
                where = "where Enabled <>0";
            }
            if (infraction != "")
            {
                where += InfractionWhere(infraction);
            }
            if (!string.IsNullOrEmpty(c))
            {
                string         cs       = "";
                IList <object> objectes = NSession.CreateSQLQuery(@"with a as(
select * from ProductCategory where ID=" + c + @"
union all
select x.* from ProductCategory x,a
where x.ParentId=a.Id)
select Name from a").List <object>();
                foreach (object item in objectes)
                {
                    cs += "'" + item + "',";
                }
                if (cs.Length > 0)
                {
                    cs = cs.Trim(',');
                }
                where += " and Category in (" + cs + ")";
            }
            IList <ProductType> objList = NSession.CreateQuery("from ProductType " + where + orderby)
                                          .SetFirstResult(rows * (page - 1))
                                          .SetMaxResults(rows)
                                          .List <ProductType>();

            foreach (ProductType item in objList)
            {
                item.Infraction = Infraction(item.SKU);
            }
            object count = NSession.CreateQuery("select count(Id) from ProductType " + where).UniqueResult();

            return(Json(new { total = count, rows = objList }));
        }
示例#12
0
 public JsonResult ToDispute(int id)
 {
     try
     {
         DisputeType obj = GetById(id);
         obj.DisputesType = "纠纷";
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }, JsonRequestBehavior.AllowGet));
     }
     return(Json(new { IsSuccess = true, ErrorMsg = "转换成功" }, JsonRequestBehavior.AllowGet));
 }
示例#13
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         SupplierType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Delete("from SuppliersProductType where SId='" + obj.Id + "'");
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
示例#14
0
        public ActionResult Edit(LogisticsAreaType obj)
        {
            obj.LId = int.Parse(Session["lid"].ToString());

            try
            {
                NSession.Update(obj);
                NSession.Flush();
            }
            catch (Exception ee)
            {
                return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
            }
            return(Json(new { IsSuccess = true }));
        }
        public JsonResult List()
        {
            IList <PermissionItemType> objList = NSession.CreateQuery("from PermissionItemType").List <PermissionItemType>();

            IList <PermissionItemType> fristList = objList.Where(p => p.ParentId == 0).OrderByDescending(p => p.SortCode).ToList();

            foreach (PermissionItemType item in fristList)
            {
                List <PermissionItemType> fooList = objList.Where(p => p.ParentId == item.Id).OrderByDescending(p => p.SortCode).ToList();
                item.children = fooList;
                GetChildren(objList, item);
            }

            return(Json(new { total = fristList.Count, rows = fristList }));
        }
示例#16
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         NoStockType obj = GetById(id);
         obj.Enabled = 0;
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
 public JsonResult Create(OrganizeType obj)
 {
     try
     {
         obj.CreateOn = DateTime.Now;
         obj.CreateBy = CurrentUser.Realname;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public JsonResult Delete(int id)
 {
     try
     {
         LanguageType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
         Language.ReLoadLanguage();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public void DelAreaCountry(string id, int tid)
        {
            LogisticsAreaCountryType logc = new LogisticsAreaCountryType {
                CountryCode = id.ToString(), AreaCode = tid
            };
            IList <LogisticsAreaCountryType> list = NSession.CreateCriteria(typeof(LogisticsAreaCountryType))
                                                    .Add(Example.Create(logc))
                                                    .List <LogisticsAreaCountryType>();

            foreach (LogisticsAreaCountryType item in list)
            {
                NSession.Delete(item);
                NSession.Flush();
            }
        }
示例#20
0
        public string Infraction(string sku)
        {
            string str = "";
            IList <ProductIsInfractionType> objs = NSession.CreateQuery("from ProductIsInfractionType where SKU='" + sku + "' and Isinfraction=1 ").List <ProductIsInfractionType>();

            foreach (var item in objs)
            {
                str += item.Platform + "<br/>";
            }
            if (str == "")
            {
                str = "否";
            }
            return(str);
        }
 public JsonResult Create(SoresAddType obj)
 {
     try
     {
         obj.CreateBy = CurrentUser.Realname;
         obj.CreateOn = DateTime.Now;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
示例#22
0
        public ActionResult SetSKUCode(int code, string sku)
        {
            return(Json(new { IsSuccess = false, Result = "此功能作废,请不要这个功能!" }));

            object count = NSession.CreateQuery("select count(Id) from ProductType where SKU='" + sku + "'").UniqueResult();

            sku = sku.Trim();
            SqlConnection conn = new SqlConnection("server=122.227.207.204;database=Feidu;uid=sa;pwd=`1q2w3e4r");
            string        sql  = "select top 1 SKU from SkuCode where Code={0}or Code={1} ";

            conn.Open();
            SqlCommand sqlCommand = new SqlCommand(string.Format(sql, code, (code + 1000000)), conn);
            object     objSKU     = sqlCommand.ExecuteScalar();

            conn.Close();
            if (objSKU != null)
            {
                if (objSKU.ToString().Trim().ToUpper() != sku.Trim().ToUpper())
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码对应是的" + objSKU + ",不是现在的:" + sku + "!" }));
                }
            }

            if (Convert.ToInt32(count) > 0)
            {
                object count1 =
                    NSession.CreateQuery("select count(Id) from SKUCodeType where Code=:p").SetInt32("p", code).
                    UniqueResult();
                if (Convert.ToInt32(count1) == 0)
                {
                    SKUCodeType skuCode = new SKUCodeType {
                        Code = code, SKU = sku, IsNew = 0, IsOut = 0
                    };
                    NSession.Save(skuCode);
                    NSession.Flush();
                    Utilities.StockIn(1, sku, 1, 0, "条码清点入库", CurrentUser.Realname, "", NSession);
                    return(Json(new { IsSuccess = true, Result = "添加成功!" }));
                }
                else
                {
                    return(Json(new { IsSuccess = false, Result = "这个条码已经添加!" }));
                }
            }
            else
            {
                return(Json(new { IsSuccess = false, Result = "没有这个产品!" }));
            }
        }
 public ActionResult Edit(PurchaseTroubleType obj)
 {
     try
     {
         obj.DealBy = CurrentUser.Realname;
         obj.DealOn = DateTime.Now;
         obj.Status = "已解决";
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
        public JsonResult List(int page, int rows, string sort, string order, string search)
        {
            string orderby = Utilities.OrdeerBy(sort, order);

            string where = Utilities.SqlWhere(search);
            List <EbayType> objList =
                NSession.CreateSQLQuery(
                    "select [Id],[ItemId],[ItemTitle],[Currency],[Price],[PicUrl],[StartNum],[NowNum],[ProductUrl],[StartTime],[CreateOn],[Account],[SKU],[Status],isnull((select top 1 COUNT(Id) from SKUCode where SKUCode.SKU = Ebay.SKU and IsOut=0 group by SKU),0) as UnPeiQty from Ebay " +
                    where + orderby).AddEntity(typeof(EbayType))
                .SetFirstResult(rows * (page - 1))
                .SetMaxResults(rows)
                .List <EbayType>().ToList();
            object count = NSession.CreateQuery("select count(Id) from EbayType " + where).UniqueResult();

            return(Json(new { total = count, rows = objList }));
        }
示例#25
0
        /// <summary>
        /// 根据Id获取
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public EmailType GetById(int Id)
        {
            EmailType obj = NSession.Get <EmailType>(Id);

            if (obj == null)
            {
                obj = new EmailType {
                    Id = 0
                };
                return(obj);
            }
            else
            {
                return(obj);
            }
        }
        public JsonResult List()
        {
            string orderby = " order by Id desc ";

            IList <LogisticsAllocationType> objList = NSession.CreateQuery("from LogisticsAllocationType " + orderby)

                                                      .List <LogisticsAllocationType>();

            foreach (LogisticsAllocationType logisticsAllocationType in objList)
            {
                logisticsAllocationType.Content  = null;
                logisticsAllocationType.QuerySql = null;
            }

            return(Json(new { total = objList.Count, rows = objList }));
        }
        public JsonResult List(int page, int rows, string sort, string order, string search)
        {
            string orderby = Utilities.OrdeerBy(sort, order, "Id desc");

            string where = Utilities.SqlWhere(search);
            //string where = string.IsNullOrWhiteSpace(search) ? string.Empty : " where " + search + " "; //Utilities.SqlWhere(search);
            List <LanguageType> objList =
                NSession.CreateQuery(
                    "from LanguageType " + where + orderby)
                .SetFirstResult(rows * (page - 1))
                .SetMaxResults(rows)
                .List <LanguageType>().ToList();
            object count = NSession.CreateQuery("select count(Id) from LanguageType " + where).UniqueResult();

            return(Json(new { total = count, rows = objList }));
        }
示例#28
0
        private void UserLogin()
        {
            string        ip  = GetClientIP();
            string        mac = GetMACByIP(ip);
            UserLoginType obj = new UserLoginType
            {
                UserCode = CurrentUser.Code,
                UserName = CurrentUser.Realname,
                IP       = ip,
                MAC      = mac,
                CreateOn = DateTime.Now
            };

            NSession.Save(obj);
            NSession.Flush();
        }
示例#29
0
 public ActionResult Edit(LogisticsType obj)
 {
     try
     {
         if (IsOk(obj.Id, obj.LogisticsCode))
         {
             return(Json(new { errorMsg = "此代码已存在,请检查后再作修改!" }));
         }
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
示例#30
0
        public JsonResult GetOrderByReturn(string o)
        {
            List <OrderType> orders =
                NSession.CreateQuery("from OrderType where OrderNo='" + o + "'").List <OrderType>().ToList();

            if (orders.Count > 0)
            {
                OrderType order = orders[0];
                if (order.Status != OrderStatusEnum.退货订单.ToString())
                {
                    string html = "<b>订单:{0}  <br/>平台:{5} <br/>账户:{6} <br/>下单时间:{1} <br/>发货时间:{2} <br/>发货渠道:{3} <br/>发货条码:{4}</b>";
                    return(Json(new { IsSuccess = true, Result = string.Format(html, order.OrderNo, order.CreateOn, order.ScanningOn, order.LogisticMode, order.TrackCode, order.Platform, order.Account) }));
                }
                return(Json(new { IsSuccess = false, Result = "该订单已经退货!请不要重复扫描!" }));
            }
            return(Json(new { IsSuccess = false, Result = "找不到该订单" }));
        }