示例#1
0
 /// <summary>
 /// 添加数据
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool Insert(DC_LoadoMeter Item)
 {
     DataBase db = new DataBase();
     DataBaseVisitor visitor = new LoadoMeterDAL();
     bool Flag = false, ReFlag = false;
     int N = 0;
     SqlParameter[] prams ={
         db.MakeInParam("@Id", SqlDbType.BigInt,0,PublicFun.PublicFun.MaxId("DC_LoadoMeter")),
         db.MakeInParam("@TableNum", SqlDbType.VarChar,50, Item.TableNum),
         db.MakeInParam("@Name", SqlDbType.VarChar,50, Item.Name),
         db.MakeInParam("@Ip", SqlDbType.VarChar,50, Item.Ip),
         db.MakeInParam("@Port", SqlDbType.VarChar,50, Item.Port),
         db.MakeInParam("@Remark", SqlDbType.VarChar,255, Item.Remark)
     };
     try
     {
         ReFlag = db.TransactSql(visitor, "Insert", prams, out N);
     }
     catch (Exception ex)
     {
         throw ex;
     }
     finally
     {
         db.Dispose();
     }
     if (ReFlag && N > 0)
     {
         Flag = true;
     }
     return Flag;
 }
示例#2
0
 //保存
 private void Btn_Save_Click(object sender, EventArgs e)
 {
     DC_LoadoMeter LoadoMeterItem = new DC_LoadoMeter();
     LoadoMeterItem.TableNum = this.Tb_TableNum.Text.Trim();
     LoadoMeterItem.Name = this.Tb_Name.Text.Trim();
     LoadoMeterItem.Ip = this.Tb_Ip.Text.Trim();
     LoadoMeterItem.Port = this.Tb_Port.Text.Trim();
     LoadoMeterItem.Remark = this.Tb_Remark.Text.Trim();
     if (LoadoMeterItem.TableNum == "")
     {
         Function.MessageWarning("请把数据填写完整!");
         return;
     }
     if (LoadoMeterItem.TableNum.Length > 3)
     {
         Function.MessageWarning("磅台号最大长度不能超过三位!");
         return;
     }
     if (Id == 0)
     {
         if (Function.CheckKey("DC_LoadoMeter", "TableNum", LoadoMeterItem.TableNum, 0))
         {
             Function.MessageWarning("该编号已存在!");
             return;
         }
         if (LoadoMeterBLL.Insert(LoadoMeterItem))
         {
             Function.Message("添加成功!");
             ResetData();
             DataBind();
         }
     }
     else
     {
         LoadoMeterItem.Id = Id;
         if (LoadoMeterBLL.Update(LoadoMeterItem))
         {
             Function.Message("修改成功!");
             DataBind();
         }
     }
 }
示例#3
0
 //设为本机
 private void Btn_SetLolal_Click(object sender, EventArgs e)
 {
     int i = this.Gv_LoadoMeter.SelectedRows[0].Index;
     DataGridViewCellCollection Dgc = this.Gv_LoadoMeter.Rows[i].Cells;
     DC_LoadoMeter LoadoMeterItem = new DC_LoadoMeter();
     LoadoMeterItem.TableNum=Dgc["Col_TableNum"].Value.ToString();
     if (LoadoMeterBLL.SetLocal(LoadoMeterItem))
     {
         Function.Message("已成功设置本机编号!");
     }
 }
示例#4
0
 /// <summary>
 /// 设为本机
 /// </summary>
 /// <param name="Item">model</param>
 /// <returns></returns>
 public static bool SetLocal(DC_LoadoMeter Item)
 {
     bool Flag = false;
     try
     {
         PublicFun.IniFile Ini = new PublicFun.IniFile(WSV.Model.FilePath.Config);
         if (Ini.ExistIniFile())
         {
             Ini.IniWriteValue("LoadoMeter", "TableNum", Item.TableNum);
         }
         Flag = true;
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return Flag;
 }