Exemplo n.º 1
0
        /// <summary>
        /// 明细删除
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void btn_DetailDelete(Object sender, EventArgs e)
        {
            string[] eCell = Grid2.SelectedCell;
            if (eCell == null)
            {
                FineUI.Alert.ShowInParent("请先选中一个删除项", FineUI.MessageBoxIcon.Information);
                return;
            }
            string a = Grid2.SelectedRowID;

            JArray    upJson = Grid2.GetMergedData();
            DataTable da     = new DataTable();

            for (int i = 0; i < upJson.Count; i++)
            {
                if (upJson[i]["status"].ToString() != "newadded" && upJson[i]["id"].ToString() == eCell[0].ToString())
                {
                    int _id = ConvertHelper.Cint(upJson[i]["values"]["Id01"].ToString());
                    //FineUI.Alert.ShowInParent(_id.ToString(), FineUI.MessageBoxIcon.Information);
                    Grid2.DeleteSelectedRows();
                    IN_BACK01Bll.GetInstence().Delete(this, _id);
                    //hidORDDEP_ID.Text = "";
                    break;
                }
                else if (upJson[i]["status"].ToString() == "newadded" && upJson[i]["id"].ToString() == eCell[0].ToString())
                {
                    Grid2.DeleteSelectedRows();
                    //hidORDDEP_ID.Text = "";
                    break;
                }
            }
        }
        /// <summary>
        /// 子表保存
        /// </summary>
        /// <returns></returns>
        public string DetailEdit()
        {
            JArray jarr   = Grid2.GetMergedData();
            var    OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
            string result = "";
            int    n      = 0;

            for (int i = 0; i < jarr.Count; i++)
            {
                try
                {
                    var model2 = new IN_BACK01();
                    //string str = jarr[i]["status"].ToString();
                    if (jarr[i]["status"].ToString().Equals("modified"))
                    {
                        model2.SetIsNew(false);
                    }
                    else if (jarr[i]["status"].ToString().Equals("unchanged"))
                    {
                        continue;
                    }
                    else
                    {
                        model2.SetIsNew(true);
                    }
                    model2.SHOP_ID = jarr[i]["values"]["SHOP_ID01"].ToString();
                    if (!String.IsNullOrEmpty(jarr[i]["values"]["IB_ID01"].ToString()))
                    {
                        model2.IB_ID = jarr[i]["values"]["IB_ID01"].ToString();
                    }
                    else
                    {
                        return("保存失败");
                    }
                    model2.SNo          = ConvertHelper.Cint(jarr[i]["values"]["SNo01"].ToString());
                    model2.PROD_ID      = jarr[i]["values"]["PROD_ID01"].ToString();
                    model2.QUANTITY     = ConvertHelper.StringToDecimal(jarr[i]["values"]["QUANTITY01"].ToString());
                    model2.STD_TYPE     = jarr[i]["values"]["STD_TYPE01"].ToString();
                    model2.STD_UNIT     = jarr[i]["values"]["STD_UNIT01"].ToString();
                    model2.STD_CONVERT  = ConvertHelper.Cint(jarr[i]["values"]["STD_CONVERT01"].ToString());
                    model2.STD_QUAN     = ConvertHelper.StringToDecimal(jarr[i]["values"]["STD_QUAN01"].ToString());
                    model2.STD_PRICE    = ConvertHelper.StringToDecimal(jarr[i]["values"]["STD_PRICE01"].ToString());
                    model2.COST         = ConvertHelper.StringToDecimal(jarr[i]["values"]["COST01"].ToString());
                    model2.QUAN1        = ConvertHelper.StringToDecimal(jarr[i]["values"]["QUAN101"].ToString());
                    model2.QUAN2        = ConvertHelper.StringToDecimal(jarr[i]["values"]["QUAN201"].ToString());
                    model2.MEMO         = jarr[i]["values"]["MEMO01"].ToString();
                    model2.BAT_NO       = jarr[i]["values"]["BAT_NO"].ToString();
                    model2.Exp_DateTime = DateTime.Now;
                    IN_BACK01Bll.GetInstence().Save(this, model2);
                }
                catch (Exception err)
                {
                    n++;
                    result = "明细保存失败" + n + "条";
                }
            }
            return(result);
        }
        public void LoadDETAIL()
        {
            string _tbxIB_ID = tbxIB_ID.Text;

            if (!String.IsNullOrEmpty(_tbxIB_ID))
            {
                List <ConditionFun.SqlqueryCondition> conditiondetail = new List <ConditionFun.SqlqueryCondition>();
                conditiondetail.Add(new ConditionFun.SqlqueryCondition(ConstraintType.Where, IN_BACK01Table.IB_ID, Comparison.Equals, _tbxIB_ID, false, false));
                IN_BACK01Bll.GetInstence().BindGrid(Grid2, 0, 0, conditiondetail, sortList);
            }
        }