示例#1
0
 public bool SaveParentCode(mdlParentCode obj_mdlParentCode, string Operation)
 {
     bool isSaved = false;
     try
     {
         SqlCommand cmd = new SqlCommand("stp_ERP_ParentCode_CRUD", conn);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.Add("@ParentID", SqlDbType.VarChar, 6).Value = obj_mdlParentCode.ParentCodeID;
         cmd.Parameters.Add("@ParentName", SqlDbType.VarChar, 20).Value = obj_mdlParentCode.ParentCodeName;
         cmd.Parameters.Add("@Description", SqlDbType.VarChar, 50).Value = obj_mdlParentCode.ParentDescription;
         cmd.Parameters.Add("@AddUser", SqlDbType.VarChar, 20).Value = obj_mdlParentCode.AddUser;
         cmd.Parameters.Add("@Operation", SqlDbType.VarChar, 20).Value = Operation == "Save" ? "Save" : "Update";
         if (conn.State == ConnectionState.Open)
         {
             conn.Close();
         }
         conn.Open();
         cmd.ExecuteNonQuery();
         if (conn.State == ConnectionState.Open)
         {
             conn.Close();
         }
         isSaved = true;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "ERP - Babar Medicine Company Lahore", MessageBoxButtons.OK, MessageBoxIcon.Error);
         if (conn.State == ConnectionState.Open)
         {
             conn.Close();
         }
     }
     return isSaved;
 }
示例#2
0
 public bool SaveParentCode(mdlParentCode obj_mdlParentCode, string Operation)
 {
     return obj_dalParentCode.SaveParentCode(obj_mdlParentCode, Operation);
 }