Beispiel #1
0
    protected void AddOrUpdate()
    {
        ASPxPageControl pageControl = this.grid.FindEditFormTemplateControl("pageControl") as ASPxPageControl;
        ASPxTextBox     txt_pId     = pageControl.FindControl("txt_Id") as ASPxTextBox;
        string          pId         = SafeValue.SafeString(txt_pId.Text, "");

        Wilson.ORMapper.OPathQuery query = new Wilson.ORMapper.OPathQuery(typeof(WhInventory), "Id='" + pId + "'");
        WhInventory obj         = C2.Manager.ORManager.GetObject(query) as WhInventory;
        bool        action      = false;
        string      inventoryNo = "";

        if (obj == null)
        {
            action      = true;
            obj         = new WhInventory();
            inventoryNo = C2Setup.GetNextNo("Inventory");
        }

        ASPxTextBox txt_InventoryNo = pageControl.FindControl("txt_InventoryNo") as ASPxTextBox;

        obj.InventoryNo = txt_InventoryNo.Text.Trim();
        ASPxDateEdit date_InventoryDate = pageControl.FindControl("date_InventoryDate") as ASPxDateEdit;

        obj.InventoryDate = date_InventoryDate.Date;

        ASPxTextBox txt_InventoryUser = pageControl.FindControl("txt_InventoryUser") as ASPxTextBox;

        obj.InventoryUser = txt_InventoryUser.Text;

        if (action)
        {
            obj.InventoryNo    = inventoryNo;
            obj.CreateBy       = HttpContext.Current.User.Identity.Name;
            obj.CreateDateTime = DateTime.Now;
            C2Setup.SetNextNo("Inventory", inventoryNo);
            Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Inserted);
            Manager.ORManager.PersistChanges(obj);
            Session["NameWhere"] = "InventoryNo='" + inventoryNo + "'";
            this.dsWhInventory.FilterExpression = Session["NameWhere"].ToString();
            if (this.grid.GetRow(0) != null)
            {
                this.grid.StartEdit(0);
            }
        }
        else
        {
            obj.UpdateBy       = HttpContext.Current.User.Identity.Name;
            obj.UpdateDateTime = DateTime.Now;
            Manager.ORManager.StartTracking(obj, Wilson.ORMapper.InitialState.Updated);
            Manager.ORManager.PersistChanges(obj);
        }
    }
Beispiel #2
0
 /// <summary>
 /// 更新盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-24 陈海裕 创建</remarks>
 public bool UpdateWhInventory(WhInventory model)
 {
     return(DataAccess.Warehouse.IWhInventoryDao.Instance.UpdateWhInventory(model) > 0);
 }
Beispiel #3
0
 /// <summary>
 /// 创建盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-20 陈海裕 创建</remarks>
 public WhInventory CreateWhInventory(WhInventory model)
 {
     return(DataAccess.Warehouse.IWhInventoryDao.Instance.CreateWhInventory(model));
 }
Beispiel #4
0
 /// <summary>
 /// 更新盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-24 陈海裕 创建</remarks>
 public override int UpdateWhInventory(WhInventory model)
 {
     return(Context.Update("WhInventory", model).AutoMap(o => o.SysNo).Where("SysNo", model.SysNo).Execute());
 }
Beispiel #5
0
 /// <summary>
 /// 创建盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-20 陈海裕 创建</remarks>
 public override WhInventory CreateWhInventory(WhInventory model)
 {
     model.SysNo = Context.Insert <WhInventory>("WhInventory", model).AutoMap(x => x.SysNo).ExecuteReturnLastId <int>("SysNo");
     return(model);
 }
Beispiel #6
0
 /// <summary>
 /// 更新盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-24 陈海裕 创建</remarks>
 public abstract int UpdateWhInventory(WhInventory model);
Beispiel #7
0
 /// <summary>
 /// 创建盘点单
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 /// <remarks>2016-06-20 陈海裕 创建</remarks>
 public abstract WhInventory CreateWhInventory(WhInventory model);