public bool AddMStockOrderItems(MStockOrderItems mstockorderitems)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@StockOrderItemNo", mstockorderitems.StockOrderItemNo);

            cmd.Parameters.AddWithValue("@ItemNo", mstockorderitems.ItemNo);

            cmd.Parameters.AddWithValue("@IsUpload", mstockorderitems.IsUpload);

            cmd.Parameters.AddWithValue("@IsGeneral", mstockorderitems.IsGeneral);

            cmd.Parameters.AddWithValue("@MRP", mstockorderitems.MRP);

            cmd.Parameters.AddWithValue("@FKRateSettingNo", mstockorderitems.FKRateSettingNo);

            cmd.Parameters.AddWithValue("@CompanyNo", mstockorderitems.CompanyNo);

            cmd.Parameters.AddWithValue("@StatusNo", mstockorderitems.StatusNo);

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

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

            commandcollection.Add(cmd);
            return(true);
        }
        public bool DeleteMStockOrderItems(MStockOrderItems mstockorderitems)
        {
            SqlCommand cmd;

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

            cmd.Parameters.AddWithValue("@StockOrderItemNo", mstockorderitems.StockOrderItemNo);
            if (ObjTrans.ExecuteNonQuery(cmd, CommonFunctions.ConStr) == true)
            {
                return(true);
            }
            else
            {
                mstockorderitems.msg = ObjTrans.ErrorMessage;
                return(false);
            }
        }
        public MStockOrderItems ModifyMStockOrderItemsByID(int ID)
        {
            SqlConnection Con = new SqlConnection(CommonFunctions.ConStr);
            string        sql;
            SqlCommand    cmd;

            sql            = "Select * from MStockOrderItems where StockOrderItemNo =" + 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)
            {
                MStockOrderItems MM = new MStockOrderItems();
                while (dr.Read())
                {
                    MM.StockOrderItemNo = Convert.ToInt32(dr["StockOrderItemNo"]);
                    if (!Convert.IsDBNull(dr["ItemNo"]))
                    {
                        MM.ItemNo = Convert.ToInt64(dr["ItemNo"]);
                    }
                    if (!Convert.IsDBNull(dr["IsUpload"]))
                    {
                        MM.IsUpload = Convert.ToBoolean(dr["IsUpload"]);
                    }
                    if (!Convert.IsDBNull(dr["IsGeneral"]))
                    {
                        MM.IsGeneral = Convert.ToBoolean(dr["IsGeneral"]);
                    }
                    if (!Convert.IsDBNull(dr["MRP"]))
                    {
                        MM.MRP = Convert.ToDouble(dr["MRP"]);
                    }
                    if (!Convert.IsDBNull(dr["FKRateSettingNo"]))
                    {
                        MM.FKRateSettingNo = Convert.ToInt64(dr["FKRateSettingNo"]);
                    }
                    if (!Convert.IsDBNull(dr["CompanyNo"]))
                    {
                        MM.CompanyNo = Convert.ToInt64(dr["CompanyNo"]);
                    }
                    if (!Convert.IsDBNull(dr["StatusNo"]))
                    {
                        MM.StatusNo = Convert.ToInt64(dr["StatusNo"]);
                    }
                    if (!Convert.IsDBNull(dr["UserID"]))
                    {
                        MM.UserID = Convert.ToInt64(dr["UserID"]);
                    }
                    if (!Convert.IsDBNull(dr["UserDate"]))
                    {
                        MM.UserDate = Convert.ToDateTime(dr["UserDate"]);
                    }
                }
                dr.Close();
                return(MM);
            }
            else
            {
                dr.Close();
            }
            return(new MStockOrderItems());
        }