Example #1
0
        public void Grid2Delete_Click(object sender, EventArgs e)
        {
            int id = ConvertHelper.Cint(GridViewHelper.GetSelectedKey(Grid2, true));

            string[] eCell = Grid2.SelectedCell;

            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"]["Id1"].ToString());
                    Grid2.DeleteSelectedRows();
                    ORDER_DEP02Bll.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;
                }
            }
            //LoadData2("");
            //LoadDepData();
        }
Example #2
0
        /// <summary>
        /// OrderDep02保存
        /// </summary>
        /// <returns></returns>
        public string OrderDep02Save()
        {
            JArray upJson = Grid2.GetMergedData();
            string result = "";

            if (upJson.Count < 1)
            {
                return("");
            }
            result = CheckOrderDop02(upJson);
            if (!String.IsNullOrEmpty(result))
            {
                return(result);
            }

            for (int i = 0; i < upJson.Count; i++)
            {
                try
                {
                    int _Id   = ConvertHelper.Cint(upJson[i]["values"]["Id1"].ToString());
                    var model = new ORDER_DEP02(x => x.Id == _Id);
                    model.ORDDEP_ID = upJson[i]["values"]["ORDDEP_ID1"].ToString();
                    model.DEP_ID    = upJson[i]["values"]["DEP_ID1"].ToString();
                    if (upJson[i]["values"]["USABLE1"].ToString() == "True")
                    {
                        model.USABLE = 1;
                    }
                    else
                    {
                        model.USABLE = 0;
                    }
                    if (upJson[i]["values"]["Meno1"] == null)
                    {
                        model.Meno = "";
                    }
                    else
                    {
                        model.Meno = upJson[i]["values"]["Meno1"].ToString();
                    }
                    model.CRT_USER_ID  = upJson[i]["values"]["CRT_USER_ID1"].ToString();
                    model.CRT_DATETIME = DateTime.Now;
                    var OlUser = OnlineUsersBll.GetInstence().GetModelForCache(x => x.UserHashKey == Session[OnlineUsersTable.UserHashKey].ToString());
                    model.MOD_DATETIME = DateTime.Now;
                    model.MOD_USER_ID  = OlUser.Manager_LoginName;
                    ORDER_DEP02Bll.GetInstence().Save(this, model);
                }
                catch (Exception err)
                {
                    result = result + upJson[i]["values"]["DEP_NAME1"].ToString() + "相关数据保存失败" + Environment.NewLine;
                }
            }
            if (String.IsNullOrEmpty(result))
            {
                result = "";
            }

            //int i = aa.Count;

            return(result);
        }