Example #1
0
        public bool AddMUOM1(MUOM muom)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "AddMUOM1";

            cmd.Parameters.AddWithValue("@UOMNo", muom.UOMNo);

            cmd.Parameters.AddWithValue("@UOMName", muom.UOMName);

            cmd.Parameters.AddWithValue("@UOMShortCode", muom.UOMShortCode);

            cmd.Parameters.AddWithValue("@IsActive", muom.IsActive);

            cmd.Parameters.AddWithValue("@UserID", muom.UserID);

            cmd.Parameters.AddWithValue("@UserDate", muom.UserDate);

            cmd.Parameters.AddWithValue("@CompanyNo", DBGetVal.FirmNo);

            cmd.Parameters.AddWithValue("@GlobalCode", muom.GlobalCode);

            //cmd.Parameters.AddWithValue("@ModifiedBy", muom.ModifiedBy);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                muom.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Example #2
0
        public MUOM ModifyMUOMByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MUOM where UOMNo =" + ID;
            cmd            = new SqlCommand(sql, Con);
            cmd.Connection = Con;
            Con.Open();
            cmd.CommandType = CommandType.Text;
            SqlDataReader dr;

            dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            if (dr.HasRows)
            {
                MUOM MM = new MUOM();
                while (dr.Read())
                {
                    MM.UOMNo = Convert.ToInt32(dr["UOMNo"]);
                    if (!Convert.IsDBNull(dr["UOMName"]))
                    {
                        MM.UOMName = Convert.ToString(dr["UOMName"]);
                    }
                    if (!Convert.IsDBNull(dr["UOMShortCode"]))
                    {
                        MM.UOMShortCode = Convert.ToString(dr["UOMShortCode"]);
                    }
                    if (!Convert.IsDBNull(dr["IsActive"]))
                    {
                        MM.IsActive = Convert.ToBoolean(dr["IsActive"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                    if (!Convert.IsDBNull(dr["ModifiedBy"]))
                    {
                        MM.ModifiedBy = Convert.ToString(dr["ModifiedBy"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MUOM());
        }
Example #3
0
        public bool DeleteMUOM(MUOM muom)
        {
            SqlCommand cmd;

            cmd             = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "DeleteMUOM";

            cmd.Parameters.AddWithValue("@UOMNo", muom.UOMNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                muom.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }