Ejemplo n.º 1
0
 protected void btn_save_Click(object sender, EventArgs e)
 {
     try
     {
         string sqlCmd = "";
         // 修改的现有数据
         Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();
         foreach (int rowIndex in modifiedDict.Keys)
         {
             int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
             sqlCmd  = "update [SFYOrderTab] set CONTACT_NAME='" + Grid1.Rows[rowIndex].Values[4].ToString() + "',";
             sqlCmd += "PHONE_NUMBER='" + Grid1.Rows[rowIndex].Values[5].ToString() + "',ADDRESS='" + Grid1.Rows[rowIndex].Values[6].ToString() + "'";
             sqlCmd += " where [SOId]=" + rowID;
             SqlSel_Pro.ExeSql(sqlCmd);
         }
         Alert.Show("已保存");
         //刷新结果集
         //tgb_PO_TriggerClick(sender, e);
         reBound();
     }
     catch (Exception ex)
     {
         Alert.Show(ex.ToString());
         return;
     }
 }
Ejemplo n.º 2
0
 protected void btn_rePush_Click(object sender, EventArgs e)
 {
     try
     {
         //是否存在非异常单
         CheckBoxField field1 = (CheckBoxField)Grid1.FindColumn("CheckBoxField1");
         string        sqlCmd = string.Empty;
         foreach (GridRow row in Grid1.Rows)
         {
             int  rowIndex = row.RowIndex;
             bool isSel    = field1.GetCheckedState(rowIndex);
             if (isSel)
             {
                 string apiState = row.Values[7].ToString();//API状态
                 int    rowID    = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                 if (apiState != "异常")
                 {
                     continue;
                 }
                 else
                 {
                     sqlCmd = "update sfyordertab set isnew='0' where SOId='" + rowID + "'";
                     SqlSel_Pro.ExeSql(sqlCmd);
                 }
             }
         }
         Alert.Show("操作成功!");
         reBound();
     }
     catch (Exception ex)
     {
         Alert.ShowInTop(ex.Message);
     }
 }
Ejemplo n.º 3
0
        //服务器端删除
        protected void deleteFromDb(int DbId)
        {
            string sqlCmd = "delete from goodsList where id=" + DbId;

            SqlSel_Pro.ExeSql(sqlCmd);
            bindGrid("ALL");
        }
Ejemplo n.º 4
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                string curUser = GetUser();
                string sqlCmd  = "";
                // 修改的现有数据
                Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();
                foreach (int rowIndex in modifiedDict.Keys)
                {
                    if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString()))
                    {
                        Alert.ShowInTop("商品编码不可为空!");
                        return;
                    }
                    int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                    sqlCmd  = "update goodsList set goodsNo='" + Grid1.Rows[rowIndex].Values[0].ToString() + "',";
                    sqlCmd += "[goodsName]='" + Grid1.Rows[rowIndex].Values[1].ToString() + "',";
                    sqlCmd += "[specification]='" + Grid1.Rows[rowIndex].Values[2].ToString().Trim() + "',";
                    sqlCmd += "enabled='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[3]) + "',";
                    sqlCmd += "[createDte]='" + DateTime.Now + "',[createUser]='" + curUser + "' ";
                    sqlCmd += "where id=" + rowID;
                    SqlSel_Pro.ExeSql(sqlCmd);
                }

                // 新增数据
                List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList();
                for (int i = 0; i < newAddedList.Count; i++)
                {
                    //DataRow rowData = CreateNewData(table, newAddedList[i]);
                    //table.Rows.Add(rowData);
                    if (string.IsNullOrEmpty(newAddedList[i]["goodsNo"].ToString()))
                    {
                        Alert.ShowInTop("商品编码不可为空!");
                        return;
                    }
                    sqlCmd  = "insert into goodsList (goodsNo,goodsName,specification,enabled,createDte,createUser) values ";
                    sqlCmd += "('" + newAddedList[i]["goodsNo"].ToString().Trim() + "','" + newAddedList[i]["goodsName"].ToString() + "','" + newAddedList[i]["specification"].ToString().Trim() + "',";
                    sqlCmd += "'" + Convert.ToBoolean(newAddedList[i]["enabled"]) + "','" + DateTime.Now + "','" + curUser + "')";
                    SqlSel_Pro.ExeSql(sqlCmd);
                }
                //表格数据重新绑定
                bindGrid("ALL");

                Alert.Show("保存成功!");
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
                return;
            }
        }
Ejemplo n.º 5
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                string sqlCmd = "";
                int    origGoodsId = 0, giftGoodsId = 0;
                // 修改的现有数据
                Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();
                foreach (int rowIndex in modifiedDict.Keys)
                {
                    if (Convert.ToBoolean(Grid1.Rows[rowIndex].Values[2]) == true & (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString()) || string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[2].ToString())))
                    {
                        Alert.ShowInTop("商品编码或赠品编码不可为空!");
                        return;
                    }
                    int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                    origGoodsId = getGoodIdByNo(Grid1.Rows[rowIndex].Values[0].ToString().Trim());
                    giftGoodsId = getGoodIdByNo(Grid1.Rows[rowIndex].Values[1].ToString().Trim());
                    if (origGoodsId == 0 || giftGoodsId == 0)
                    {
                        Alert.ShowInTop("商品编码不存在,请校验!");
                        return;
                    }
                    sqlCmd  = "update SaleAct set origGoodsId=" + origGoodsId + ",";
                    sqlCmd += "giftGoodsId=" + giftGoodsId + ",";
                    sqlCmd += "enabled='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[2]) + "',";
                    sqlCmd += "startDte='" + Convert.ToDateTime(Grid1.Rows[rowIndex].Values[3]) + "',";
                    sqlCmd += "endDte='" + Convert.ToDateTime(Grid1.Rows[rowIndex].Values[4]) + "' ";
                    sqlCmd += "where id=" + rowID;
                    SqlSel_Pro.ExeSql(sqlCmd);
                }

                // 新增数据
                List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList();
                for (int i = 0; i < newAddedList.Count; i++)
                {
                    //DataRow rowData = CreateNewData(table, newAddedList[i]);
                    //table.Rows.Add(rowData);
                    if (Convert.ToBoolean(newAddedList[i]["enabled"]) == true & (string.IsNullOrEmpty(newAddedList[i]["goodsNo"].ToString()) || string.IsNullOrEmpty(newAddedList[i]["giftNo"].ToString())))
                    {
                        Alert.ShowInTop("商品编码或赠品编码不可为空!");
                        return;
                    }

                    origGoodsId = getGoodIdByNo(newAddedList[i]["goodsNo"].ToString().Trim());
                    giftGoodsId = getGoodIdByNo(newAddedList[i]["giftNo"].ToString().Trim());
                    if (origGoodsId == 0 || giftGoodsId == 0)
                    {
                        Alert.ShowInTop("商品编码不存在,请校验!");
                        return;
                    }

                    sqlCmd  = "insert into SaleAct (origGoodsId,giftGoodsId,enabled,startDte,endDte) values ";
                    sqlCmd += "(" + origGoodsId + "," + giftGoodsId + ",'" + Convert.ToBoolean(newAddedList[i]["enabled"]) + "',";
                    sqlCmd += "'" + Convert.ToDateTime(newAddedList[i]["startDte"]) + "','" + Convert.ToDateTime(newAddedList[i]["endDte"]) + "')";
                    SqlSel_Pro.ExeSql(sqlCmd);
                }
                //表格数据重新绑定
                bindGrid("ALL");

                Alert.Show("保存成功!");
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
                return;
            }
        }
Ejemplo n.º 6
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            try
            {
                string sqlCmd = "";
                // 修改的现有数据
                Dictionary <int, Dictionary <string, object> > modifiedDict = Grid1.GetModifiedDict();
                foreach (int rowIndex in modifiedDict.Keys)
                {
                    if (string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[0].ToString()) || string.IsNullOrEmpty(Grid1.Rows[rowIndex].Values[2].ToString()))
                    {
                        Alert.ShowInTop("商品编码或索菲亚编码不可为空!");
                        return;
                    }
                    if (Convert.ToBoolean(Grid1.Rows[rowIndex].Values[3]) == true & Convert.ToInt32(Grid1.Rows[rowIndex].Values[4]) == 0)
                    {
                        Alert.ShowInTop("不为最小单位的商品请添加计量数量!");
                        return;
                    }
                    int rowID = Convert.ToInt32(Grid1.DataKeys[rowIndex][0]);
                    sqlCmd  = "update t_MapGoodsList set goodsNo='" + Grid1.Rows[rowIndex].Values[0].ToString() + "',";
                    sqlCmd += "goodsSpec='" + Grid1.Rows[rowIndex].Values[1].ToString() + "',";
                    sqlCmd += "targetNo='" + Grid1.Rows[rowIndex].Values[2].ToString().Trim() + "',";
                    sqlCmd += "isMinUnitOrNo='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[3]) + "',";
                    sqlCmd += "UnitTimes=" + Convert.ToInt32(Grid1.Rows[rowIndex].Values[4]) + ",isOrder='" + Convert.ToBoolean(Grid1.Rows[rowIndex].Values[5]) + "' ";
                    sqlCmd += "where id=" + rowID;
                    SqlSel_Pro.ExeSql(sqlCmd);
                }

                // 新增数据
                List <Dictionary <string, object> > newAddedList = Grid1.GetNewAddedList();
                DataTable table = createDataTable();
                for (int i = 0; i < newAddedList.Count; i++)
                {
                    //DataRow rowData = CreateNewData(table, newAddedList[i]);
                    //table.Rows.Add(rowData);
                    if (string.IsNullOrEmpty(newAddedList[i]["goodsNo"].ToString()) || string.IsNullOrEmpty(newAddedList[i]["targetNo"].ToString()))
                    {
                        Alert.ShowInTop("商品编码或索菲亚编码不可为空!");
                        return;
                    }
                    if (Convert.ToBoolean(newAddedList[i]["isMinUnitOrNo"]) == true & Convert.ToInt32(newAddedList[i]["UnitTimes"]) == 0)
                    {
                        Alert.ShowInTop("不为最小单位的商品请添加计量数量!");
                        return;
                    }
                    sqlCmd  = "insert into t_MapGoodsList (goodsNo,goodsSpec,targetNo,isMinUnitOrNo,UnitTimes,isOrder) values ";
                    sqlCmd += "('" + newAddedList[i]["goodsNo"].ToString().Trim() + "','" + newAddedList[i]["goodsSpec"].ToString() + "','" + newAddedList[i]["targetNo"].ToString().Trim() + "',";
                    sqlCmd += "'" + Convert.ToBoolean(newAddedList[i]["isMinUnitOrNo"]) + "'," + Convert.ToInt32(newAddedList[i]["UnitTimes"]) + ",'" + Convert.ToBoolean(newAddedList[i]["isOrder"]) + "')";
                    SqlSel_Pro.ExeSql(sqlCmd);
                }
                //表格数据重新绑定
                bindGrid("ALL");

                Alert.Show("保存成功!");
            }
            catch (Exception ex)
            {
                Alert.ShowInTop(ex.Message);
                return;
            }
        }