示例#1
0
 private bool UpdateICS_Material(String my_MaterialID, String my_MaterialName, String my_SystemQuantity, TextBox my_RealQuantity, String my_MaterialCost)
 {
     Staff _operator = new Staff("Company");
     float a = Convert.ToSingle(my_SystemQuantity);
     float b = Convert.ToSingle(my_RealQuantity.Text);
     float c = Convert.ToSingle(my_MaterialCost);
     int mat = Convert.ToInt32(my_MaterialID);
     string sql = "INSERT INTO [MROS].[dbo].[ICS_ReInventory]([MaterialID],[MaterialName],[SystemQuantity],[RealQuantity],[RelnventoryQuantity],[MaterialCost],[RelnventoryCost],[RelnventoryDate],[UpdateTime],[UpdateUser]) " +
                  " VALUES('" + mat + "','" + my_MaterialName + "','" + my_SystemQuantity + "','" + my_RealQuantity.Text + "','" + (a - b) + "','" + my_MaterialCost + "' ,'" + (b * c) + " ',getdate(),getdate(),'admin')";
     return _operator.ExecuteStatement(sql);
 }
示例#2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        Staff _operator = new Staff("Company");
        //物料名稱
        String my_MaterialName = txt_MaterialName.Text;
        //物料單位
        String my_MaterialUnit = txt_MaterialUnit.Text;
        //安全存量
        String my_MaterialSafeQuantity = txt_MaterialSafeQuantity.Text;
        //更新人員
        String USER;
        if (Session["UserID"] != null)
        {
            USER = Session["UserID"].ToString();
        }
        else
        {
            USER = "******";
        }
        if (hidden_Action.Value == "add")
        {
            string sql = "INSERT INTO ICS_Material (MaterialName,MaterialUnit,MaterialSafeQuantity,UpdateTime,UpdateUser,MaterialTypeID) VALUES  ('" + my_MaterialName.ToString() + "','" + my_MaterialUnit.ToString() + "','" + my_MaterialSafeQuantity.ToString() + "',getdate(),'" + USER + "','" + cbo_materialType.SelectedValue + "')  ";
            if (_operator.ExecuteStatement(sql))
            {
                ShowMsg2(UpdatePanel1, "儲存成功");
                UpdateServerData(); //更新Application Data
                Response.AddHeader("Refresh", "3; url=Inventory_AQM.aspx");
            }
            else
            {
                ShowMsg2(UpdatePanel1, "儲存失敗");

            }
        }
        else
        {
            SQLDB db = new SQLDB();
            DataSet ds = new DataSet();
            ds = db.Select("NO = '"+hidden_Materialid.Value+"'","","ICS_Material");
            DataRow dr = ds.Tables[0].Rows[0];
            dr["MaterialName"] = my_MaterialName.ToString();
            dr["MaterialUnit"] = my_MaterialUnit.ToString();
            dr["MaterialSafeQuantity"] = my_MaterialSafeQuantity.ToString();
            dr["UpdateTime"] = DateTime.Now;
            dr["UpdateUser"] = USER;
            dr["MaterialTypeID"] = cbo_materialType.SelectedValue;
            DataSet DSChange = ds.GetChanges(DataRowState.Modified);
            //string sql = "UPDATE from ICS_Material (MaterialName,MaterialUnit,MaterialSafeQuantity,UpdateTime,UpdateUser,MaterialTypeID) VALUES  ('" + my_MaterialName.ToString() + "','" + my_MaterialUnit.ToString() + "','" + my_MaterialSafeQuantity.ToString() + "',getdate(),'" + USER + "','" + cbo_materialType.SelectedValue + "')  ";
            if (db.Update(DSChange))
            {
                ShowMsg2(UpdatePanel1, "儲存成功");
                UpdateServerData(); //更新Application Data
                Response.AddHeader("Refresh", "3; url=Inventory_AQM.aspx");
            }
            else
            {
                ShowMsg2(UpdatePanel1, "儲存失敗");

            }
        }

    }
示例#3
0
 private bool DELICS_Material(String my_NO)
 {
     Staff _operator = new Staff("Company");
     string sql = "DELETE FROM ICS_Material WHERE NO = '" + my_NO + "'  ";
     return _operator.ExecuteStatement(sql);
 }
示例#4
0
 private bool UpdateICS_Material(String my_NO, TextBox my_MaterialName, TextBox my_PurchaseUnit, TextBox my_ConsumeUnit, TextBox my_ConversionFactor, TextBox my_MaterialSafeQuantity, TextBox my_MaterialTypeID, TextBox my_MaterialUnit, TextBox my_Active)
 {
     Staff _operator = new Staff("Company");
     string sql = " UPDATE ICS_Material SET MaterialName = '" + my_MaterialName.Text + "', MaterialSafeQuantity = '" + my_MaterialSafeQuantity.Text + "'"+
                  " , MaterialUnit = '" + my_MaterialUnit.Text + "', Active = '" + my_Active.Text + "' " +
                  " WHERE NO = '" + my_NO + "' ";
     return _operator.ExecuteStatement(sql);
 }
示例#5
0
 private bool DELICS_Material(String my_RelnventoryID)
 {
     Staff _operator = new Staff("Company");
     string sql = "DELETE FROM ICS_ReInventory WHERE RelnventoryID = '" + my_RelnventoryID + "'  ";
     return _operator.ExecuteStatement(sql);
 }