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 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 JsonResult DeleteConfirmed(int id)
 {
     try
     {
         PermissionScopeType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 4
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 }));
        }
Esempio n. 6
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 }));
        }
 public ActionResult Edit(LanguageType obj)
 {
     try
     {
         NSession.Clear();
         NSession.Update(obj);
         NSession.Flush();
         Language.ReLoadLanguage();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 8
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));
 }
 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" }));
 }
 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 }));
 }
Esempio n. 11
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 }));
 }
Esempio n. 12
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 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();
            }
        }
Esempio n. 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 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 }));
 }
Esempio n. 16
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" }));
 }
Esempio n. 18
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();
        }
Esempio n. 19
0
        public ActionResult DoNo(int o)
        {
            QuestionOrderType obj       = GetById(o);
            OrderType         orderType = NSession.Get <OrderType>(obj.OId);

            if (orderType != null)
            {
                orderType.Enabled = 0;
                NSession.Update(orderType);
                NSession.Flush();
                obj.Status = 2;
                NSession.Update(obj);
                NSession.Flush();
                OrderHelper.GetOrderRecord(orderType, "拒绝问题订单", "" + CurrentUser.Realname + "将订单设为隐藏!", CurrentUser.Realname, NSession);
            }
            return(Json(new { IsSuccess = "true" }));
        }
Esempio n. 20
0
 public JsonResult Create(CountryType obj)
 {
     try
     {
         if (IsCreateOk(obj.ECountry))
         {
             return(Json(new { errorMsg = "编号已经存在" }));
         }
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 21
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 }));
 }
Esempio n. 22
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         StockInType obj = GetById(id);
         NSession.Delete("from SKUCodeType where PlanNo='" + obj.Id + "'");
         NSession.Flush();
         Utilities.StockOut(1, obj.SKU, obj.Qty, "入库删除", CurrentUser.Realname, "", "", NSession);
         NSession.Delete(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 23
0
 public JsonResult Create(logisticsSetupType obj)
 {
     try
     {
         obj.SetupName     = obj.SetupId;
         obj.CreateOn      = DateTime.Now;
         obj.CreateBy      = GetCurrentAccount().Realname;
         obj.LogisticsName = NSession.Get <LogisticsType>(obj.LId).LogisticsName;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { errorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = "true" }));
 }
Esempio n. 24
0
 public ActionResult Edit(DictionaryClassType obj)
 {
     try
     {
         DictionaryClassType c = GetById(obj.Id);
         NSession.CreateSQLQuery("update Dictionarys set DicCode='" + obj.Code + "' where DicCode='" + c.Code + "' ")
         .UniqueResult();
         NSession.Clear();
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public JsonResult Create(LogisticsModeType obj)
 {
     try
     {
         if (IsCreateOk(obj.ParentID, obj.LogisticsCode))
         {
             return(Json(new { errorMsg = "此代码已存在!" }));
         }
         NSession.Save(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public ActionResult Edit(MachineType obj)
 {
     try
     {
         if (IsOk(obj.Id, obj.Code))
         {
             return(Json(new { errorMsg = "编号已经存在" }));
         }
         NSession.Update(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 27
0
 public JsonResult DeleteConfirmed(int id)
 {
     try
     {
         ProductType obj = GetById(id);
         NSession.Delete(obj);
         NSession.Flush();
         NSession.Delete("from WarehouseStockType where SKU='" + obj.SKU + "'");
         NSession.Flush();
         LoggerUtil.GetProductRecord(obj, "删除商品", "商品被删除", CurrentUser, NSession);
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
Esempio n. 28
0
 public JsonResult Create(LogisticsType obj)
 {
     try
     {
         if (IsCreateOk(obj.LogisticsCode))
         {
             return(Json(new { errorMsg = "此代码已存在,请检查后再创建!" }));
         }
         obj.CreateOn = DateTime.Now;
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "出错了" }));
     }
     return(Json(new { IsSuccess = true }));
 }
 public JsonResult Save(AccountFeeType obj)
 {
     try
     {
         if (obj.AmountBegin >= obj.AmountEnd)
         {
             return(Json(new { IsSuccess = false, ErrorMsg = "开始金额不能大于结束金额" }));
         }
         new System.Data.DataTable().Compute(obj.FeeFormula.Replace("T", "10"), "");
         NSession.SaveOrUpdate(obj);
         NSession.Flush();
     }
     catch (Exception ee)
     {
         return(Json(new { IsSuccess = false, ErrorMsg = "公式错误" }));
     }
     return(Json(new { IsSuccess = true }));
 }
        public ActionResult ResetFreight(string search, decimal z)
        {
            string orderby;

            var where = GetWhere(null, null, search, out @orderby);
            IList <OrderType> objList = NSession.CreateQuery("from OrderType " + where + orderby)
                                        .List <OrderType>();

            foreach (OrderType orderType in objList)
            {
                double d = 0;
                orderType.Freight = Convert.ToDouble(OrderHelper.GetFreight(orderType.Weight, orderType.LogisticMode, orderType.Country, NSession, z));
                NSession.SaveOrUpdate(orderType);
                NSession.Flush();
                OrderHelper.SaveAmount(orderType, NSession);
            }
            return(Json(new { IsSuccess = true }));
        }