Beispiel #1
0
        public bool AddMGodown(MGodown mgodown)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@GodownNo", mgodown.GodownNo);

            cmd.Parameters.AddWithValue("@GodownName", mgodown.GodownName);

            cmd.Parameters.AddWithValue("@ControlGroup", mgodown.ControlGroup);

            cmd.Parameters.AddWithValue("@LocationNo", mgodown.LocationNo);

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

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

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

            cmd.Parameters.AddWithValue("@CompanyNo", mgodown.CompanyNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mgodown.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Beispiel #2
0
        public bool DeleteMGodown(MGodown mgodown)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@GodownNo", mgodown.GodownNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mgodown.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Beispiel #3
0
        public MGodown ModifyMGodownByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MGodown where GodownNo =" + 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)
            {
                MGodown MM = new MGodown();
                while (dr.Read())
                {
                    MM.GodownNo = Convert.ToInt32(dr["GodownNo"]);
                    if (!Convert.IsDBNull(dr["GodownName"]))
                    {
                        MM.GodownName = Convert.ToString(dr["GodownName"]);
                    }
                    if (!Convert.IsDBNull(dr["ControlGroup"]))
                    {
                        MM.ControlGroup = Convert.ToInt64(dr["ControlGroup"]);
                    }
                    if (!Convert.IsDBNull(dr["LocationNo"]))
                    {
                        MM.LocationNo = Convert.ToInt64(dr["LocationNo"]);
                    }
                    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"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MGodown());
        }