Пример #1
0
        public bool AddMStockLocation(MStockLocation mstocklocation)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@StockLocationNo", mstocklocation.StockLocationNo);

            cmd.Parameters.AddWithValue("@StockLocationName", mstocklocation.StockLocationName);

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

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

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

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

            cmd.Parameters.AddWithValue("@CompanyNo", mstocklocation.CompanyNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mstocklocation.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
Пример #2
0
        public MStockLocation ModifyMStockLocationByID(long ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MStockLocation where StockLocationNo =" + 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)
            {
                MStockLocation MM = new MStockLocation();
                while (dr.Read())
                {
                    MM.StockLocationNo = Convert.ToInt32(dr["StockLocationNo"]);
                    if (!Convert.IsDBNull(dr["StockLocationName"]))
                    {
                        MM.StockLocationName = Convert.ToString(dr["StockLocationName"]);
                    }
                    if (!Convert.IsDBNull(dr["GodownNo"]))
                    {
                        MM.GodownNo = Convert.ToInt64(dr["GodownNo"]);
                    }
                    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 MStockLocation());
        }
Пример #3
0
        public bool DeleteMStockLocation(MStockLocation mstocklocation)
        {
            SqlCommand cmd;

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

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