private void SetValues(String sm_ProductPart)
        {
            try
            {
                M_ProductPartDL objm_ProductPartDL = new M_ProductPartDL();
                if (sm_ProductPart != "")
                {
                    M_ProductParts objm_ProductPart = new M_ProductParts();
                    objm_ProductPart.IDX = sm_ProductPart.Trim();
                    objm_ProductPart     = new M_ProductPartDL().Selectm_ProductPart(objm_ProductPart);

                    if (objm_ProductPart != null)
                    {
                        txt_IDX.Text           = objm_ProductPart.IDX.ToString();
                        txt_PartNo.Text        = objm_ProductPart.PartNo.ToString();
                        txt_PartName.Text      = objm_ProductPart.PartName.ToString();
                        txt_ModelNO.Text       = objm_ProductPart.ModelNO.ToString();
                        txt_SerialNo.Text      = objm_ProductPart.SerialNo.ToString();
                        txt_SKU.Text           = objm_ProductPart.SKU.ToString();
                        txt_MfctCode.Text      = objm_ProductPart.MfctCode.ToString();
                        txt_UnitOfMeasure.Text = objm_ProductPart.UnitOfMeasure.ToString();
                        txt_Color.Text         = objm_ProductPart.Color.ToString();
                        txt_UnitPrice.Text     = objm_ProductPart.UnitPrice.ToString();
                        txt_SellingPrice.Text  = objm_ProductPart.SellingPrice.ToString();
                        txt_CostPrice.Text     = objm_ProductPart.CostPrice.ToString();
                        formMode = 3;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #2
0
        /// <summary>
        /// Saves a record to the M_ProductParts table.
        /// </summary>
        public Boolean Savem_ProductPartSP(M_ProductParts m_ProductPart, int formMode)
        {
            SqlCommand scom;
            bool       retvalue = false;

            try
            {
                scom             = new SqlCommand();
                scom.CommandType = CommandType.StoredProcedure;
                scom.CommandText = "M_ProductPartsSave";

                scom.Parameters.Add("@IDX", SqlDbType.VarChar, 20).Value           = m_ProductPart.IDX;
                scom.Parameters.Add("@PartNo", SqlDbType.VarChar, 20).Value        = m_ProductPart.PartNo;
                scom.Parameters.Add("@PartName", SqlDbType.VarChar, 100).Value     = m_ProductPart.PartName;
                scom.Parameters.Add("@ModelNO", SqlDbType.VarChar, 20).Value       = m_ProductPart.ModelNO;
                scom.Parameters.Add("@SerialNo", SqlDbType.VarChar, 20).Value      = m_ProductPart.SerialNo;
                scom.Parameters.Add("@SKU", SqlDbType.VarChar, 20).Value           = m_ProductPart.SKU;
                scom.Parameters.Add("@SuppCode", SqlDbType.VarChar, 20).Value      = m_ProductPart.SuppCode;
                scom.Parameters.Add("@MfctCode", SqlDbType.VarChar, 20).Value      = m_ProductPart.MfctCode;
                scom.Parameters.Add("@UnitOfMeasure", SqlDbType.VarChar, 10).Value = m_ProductPart.UnitOfMeasure;
                scom.Parameters.Add("@Color", SqlDbType.VarChar, 10).Value         = m_ProductPart.Color;
                scom.Parameters.Add("@Brand", SqlDbType.VarChar, 10).Value         = m_ProductPart.Brand;
                scom.Parameters.Add("@Capacity", SqlDbType.VarChar, 10).Value      = m_ProductPart.Capacity;
                scom.Parameters.Add("@UnitPrice", SqlDbType.Decimal, 9).Value      = m_ProductPart.UnitPrice;
                scom.Parameters.Add("@SellingPrice", SqlDbType.Decimal, 9).Value   = m_ProductPart.SellingPrice;
                scom.Parameters.Add("@CostPrice", SqlDbType.Decimal, 9).Value      = m_ProductPart.CostPrice;
                scom.Parameters.Add("@AvgPrice", SqlDbType.Decimal, 9).Value       = m_ProductPart.AvgPrice;
                scom.Parameters.Add("@PackSize", SqlDbType.Decimal, 9).Value       = m_ProductPart.PackSize;
                scom.Parameters.Add("@ReOrderLevel", SqlDbType.Decimal, 9).Value   = m_ProductPart.ReOrderLevel;
                scom.Parameters.Add("@MinQty", SqlDbType.Decimal, 9).Value         = m_ProductPart.MinQty;
                scom.Parameters.Add("@EOQty", SqlDbType.Decimal, 9).Value          = m_ProductPart.EOQty;
                scom.Parameters.Add("@ReOrderQty", SqlDbType.Decimal, 9).Value     = m_ProductPart.ReOrderQty;
                scom.Parameters.Add("@CreateUser", SqlDbType.VarChar, 20).Value    = m_ProductPart.CreateUser;
                scom.Parameters.Add("@CreateDate", SqlDbType.DateTime, 8).Value    = m_ProductPart.CreateDate;
                scom.Parameters.Add("@ModifyUser", SqlDbType.VarChar, 20).Value    = m_ProductPart.ModifyUser;
                scom.Parameters.Add("@ModifyDate", SqlDbType.DateTime, 8).Value    = m_ProductPart.ModifyDate;
                scom.Parameters.Add("@InsMode", SqlDbType.Int).Value  = formMode; // For insert
                scom.Parameters.Add("@RtnValue", SqlDbType.Int).Value = 0;

                u_DBConnection dbcon = new u_DBConnection();
                retvalue = dbcon.RunQuery(scom);
                return(retvalue);
            }
            catch (Exception ex)
            {
                throw (ex);
            }
        }
Exemple #3
0
        public List <M_ProductParts> SelectM_ProductPartMulti(M_ProductParts objm_ProductPart2)
        {
            List <M_ProductParts> retval = new List <M_ProductParts>();

            try
            {
                strquery = @"select * from m_ProductPart where purchaseReqNo = '" + objm_ProductPart2.Capacity + "'";
                DataTable dtm_ProductPart = u_DBConnection.ReturnDataTable(strquery, CommandType.Text);
                foreach (DataRow drType in dtm_ProductPart.Rows)
                {
                    if (drType != null)
                    {
                        M_ProductParts objm_ProductPart = new M_ProductParts();
                        objm_ProductPart.IDX           = drType["IDX"].ToString();
                        objm_ProductPart.PartNo        = drType["PartNo"].ToString();
                        objm_ProductPart.PartName      = drType["PartName"].ToString();
                        objm_ProductPart.ModelNO       = drType["ModelNO"].ToString();
                        objm_ProductPart.SerialNo      = drType["SerialNo"].ToString();
                        objm_ProductPart.SKU           = drType["SKU"].ToString();
                        objm_ProductPart.SuppCode      = drType["SuppCode"].ToString();
                        objm_ProductPart.MfctCode      = drType["MfctCode"].ToString();
                        objm_ProductPart.UnitOfMeasure = drType["UnitOfMeasure"].ToString();
                        objm_ProductPart.Color         = drType["Color"].ToString();
                        objm_ProductPart.Brand         = drType["Brand"].ToString();
                        objm_ProductPart.Capacity      = drType["Capacity"].ToString();
                        objm_ProductPart.UnitPrice     = decimal.Parse(drType["UnitPrice"].ToString());
                        objm_ProductPart.SellingPrice  = decimal.Parse(drType["SellingPrice"].ToString());
                        objm_ProductPart.CostPrice     = decimal.Parse(drType["CostPrice"].ToString());
                        objm_ProductPart.AvgPrice      = decimal.Parse(drType["AvgPrice"].ToString());
                        objm_ProductPart.PackSize      = decimal.Parse(drType["PackSize"].ToString());
                        objm_ProductPart.ReOrderLevel  = decimal.Parse(drType["ReOrderLevel"].ToString());
                        objm_ProductPart.MinQty        = decimal.Parse(drType["MinQty"].ToString());
                        objm_ProductPart.EOQty         = decimal.Parse(drType["EOQty"].ToString());
                        objm_ProductPart.ReOrderQty    = decimal.Parse(drType["ReOrderQty"].ToString());
                        objm_ProductPart.CreateUser    = drType["CreateUser"].ToString();
                        objm_ProductPart.CreateDate    = DateTime.Parse(drType["CreateDate"].ToString());
                        objm_ProductPart.ModifyUser    = drType["ModifyUser"].ToString();
                        objm_ProductPart.ModifyDate    = DateTime.Parse(drType["ModifyDate"].ToString());
                        retval.Add(objm_ProductPart);
                    }
                }
                return(retval);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemple #4
0
        public static string FindExisitingParts(string suppcode)
        {
            string str = "";

            if (M_ProductPartDL.ExistingM_ProductPart(suppcode.Trim()))
            {
                M_ProductParts cat = new M_ProductParts();
                cat.IDX = suppcode.Trim();
                cat     = new M_ProductPartDL().Selectm_ProductPart(cat);
                str     = cat.PartName.Trim();
            }
            else
            {
                str = "<Error!!!>";
            }
            return(str);
        }
Exemple #5
0
 public M_ProductParts Selectm_ProductPart(M_ProductParts objm_ProductPart)
 {
     try
     {
         strquery = @"select * from m_ProductParts where IDX = '" + objm_ProductPart.IDX + "'";
         DataRow drType = u_DBConnection.ReturnDataRow(strquery);
         if (drType != null)
         {
             objm_ProductPart.IDX           = drType["IDX"].ToString();
             objm_ProductPart.PartNo        = drType["PartNo"].ToString();
             objm_ProductPart.PartName      = drType["PartName"].ToString();
             objm_ProductPart.ModelNO       = drType["ModelNO"].ToString();
             objm_ProductPart.SerialNo      = drType["SerialNo"].ToString();
             objm_ProductPart.SKU           = drType["SKU"].ToString();
             objm_ProductPart.SuppCode      = drType["SuppCode"].ToString();
             objm_ProductPart.MfctCode      = drType["MfctCode"].ToString();
             objm_ProductPart.UnitOfMeasure = drType["UnitOfMeasure"].ToString();
             objm_ProductPart.Color         = drType["Color"].ToString();
             objm_ProductPart.Brand         = drType["Brand"].ToString();
             objm_ProductPart.Capacity      = drType["Capacity"].ToString();
             objm_ProductPart.UnitPrice     = decimal.Parse(drType["UnitPrice"].ToString());
             objm_ProductPart.SellingPrice  = decimal.Parse(drType["SellingPrice"].ToString());
             objm_ProductPart.CostPrice     = decimal.Parse(drType["CostPrice"].ToString());
             objm_ProductPart.AvgPrice      = decimal.Parse(drType["AvgPrice"].ToString());
             objm_ProductPart.PackSize      = decimal.Parse(drType["PackSize"].ToString());
             objm_ProductPart.ReOrderLevel  = decimal.Parse(drType["ReOrderLevel"].ToString());
             objm_ProductPart.MinQty        = decimal.Parse(drType["MinQty"].ToString());
             objm_ProductPart.EOQty         = decimal.Parse(drType["EOQty"].ToString());
             objm_ProductPart.ReOrderQty    = decimal.Parse(drType["ReOrderQty"].ToString());
             objm_ProductPart.CreateUser    = drType["CreateUser"].ToString();
             objm_ProductPart.CreateDate    = DateTime.Parse(drType["CreateDate"].ToString());
             objm_ProductPart.ModifyUser    = drType["ModifyUser"].ToString();
             objm_ProductPart.ModifyDate    = DateTime.Parse(drType["ModifyDate"].ToString());
             return(objm_ProductPart);
         }
         return(null);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
        private void performButtons(xEnums.PerformanceType xenum)
        {
            switch (xenum)
            {
            case xEnums.PerformanceType.View:

                break;

            case xEnums.PerformanceType.New:
                FunctionButtonStatus(xEnums.PerformanceType.New);
                //txt_IDX.Text = commonFunctions.GetSerial("A0009");
                formMode = 1;

                //txt_subcat_name.Text = "";
                //txt_subcat.Text = "";
                //txt_suppliername.Text = "";
                //txt_categoryName.Text = "";

                txt_UnitPrice.Text = "0.00";
                txt_CostPrice.Text = "0.00";
                txt_SKU.Text       = "";
                txt_MfctCode.Text  = "";

                txt_ModelNO.Text = "";

                txt_SerialNo.Text = "";

                txt_SellingPrice.Text = "0.00";
                txt_IDX.Text          = "";
                txt_PartName.Text     = "";


                txt_IDX.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Edit:
                FunctionButtonStatus(xEnums.PerformanceType.Edit);
                formMode        = 3;
                txt_IDX.Enabled = false;
                txt_PartName.Focus();
                errorProvider1.Clear();
                break;

            case xEnums.PerformanceType.Save:
                if (txt_IDX.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_IDX, "Please enter a product code !");
                    return;
                }


                if (txt_PartName.Text.Trim() == "")
                {
                    errorProvider1.SetError(txt_PartName, "Please enter a part name !");
                    return;
                }

                if (formMode == 1)
                {
                    if (M_ProductPartDL.ExistingM_ProductPart(txt_IDX.Text.Trim()))
                    {
                        errorProvider1.SetError(txt_IDX, "The part code you have entered already exists!");
                        return;
                    }


                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Save, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        using (var scope = new System.Transactions.TransactionScope())
                        {
                            //adding the product
                            M_ProductParts objm_ProductPart = new M_ProductParts();
                            objm_ProductPart.IDX           = txt_IDX.Text.Trim();
                            objm_ProductPart.PartNo        = txt_PartNo.Text.Trim();
                            objm_ProductPart.PartName      = txt_PartName.Text.Trim();
                            objm_ProductPart.ModelNO       = txt_ModelNO.Text.Trim();
                            objm_ProductPart.SerialNo      = txt_SerialNo.Text.Trim();
                            objm_ProductPart.SKU           = txt_SKU.Text.Trim();
                            objm_ProductPart.SuppCode      = "";// txt_SuppCode.Text.Trim();
                            objm_ProductPart.MfctCode      = txt_MfctCode.Text.Trim();
                            objm_ProductPart.UnitOfMeasure = txt_UnitOfMeasure.Text.Trim();
                            objm_ProductPart.Color         = txt_Color.Text.Trim();
                            objm_ProductPart.Brand         = txt_SKU.Text.Trim();
                            objm_ProductPart.Capacity      = "";
                            objm_ProductPart.UnitPrice     = Convert.ToDecimal(txt_UnitPrice.Text.Trim());
                            objm_ProductPart.SellingPrice  = Convert.ToDecimal(txt_SellingPrice.Text.Trim());
                            objm_ProductPart.CostPrice     = Convert.ToDecimal(txt_CostPrice.Text.Trim());
                            objm_ProductPart.AvgPrice      = Convert.ToDecimal(txt_CostPrice.Text.Trim());
                            objm_ProductPart.PackSize      = 0;
                            objm_ProductPart.ReOrderLevel  = 0;
                            objm_ProductPart.MinQty        = 10;
                            objm_ProductPart.EOQty         = 60;
                            objm_ProductPart.ReOrderQty    = 50;
                            objm_ProductPart.CreateUser    = commonFunctions.Loginuser;
                            objm_ProductPart.CreateDate    = DateTime.Now;
                            objm_ProductPart.ModifyUser    = commonFunctions.Loginuser;
                            objm_ProductPart.ModifyDate    = DateTime.Now;
                            new M_ProductPartDL().Savem_ProductPartSP(objm_ProductPart, 1);
                            //commonFunctions.IncrementSerial("A0009");

                            scope.Complete();
                        }

                        GetData();

                        txt_IDX.Enabled = true;
                        FunctionButtonStatus(xEnums.PerformanceType.Save);
                        commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Save_Sucess_string, 2);
                    }
                }
                else if (formMode == 3)
                {
                    if (UserDefineMessages.ShowMsg("", UserDefineMessages.Msg_PerfmBtn_Update, commonFunctions.Softwarename.Trim()) == System.Windows.Forms.DialogResult.Yes)
                    {
                        using (var scope = new System.Transactions.TransactionScope())
                        {
                            M_ProductParts objm_ProductPart = new M_ProductParts();
                            objm_ProductPart.IDX           = txt_IDX.Text.Trim();
                            objm_ProductPart.PartNo        = txt_PartNo.Text.Trim();
                            objm_ProductPart               = new M_ProductPartDL().Selectm_ProductPart(objm_ProductPart);
                            objm_ProductPart.PartName      = txt_PartName.Text.Trim();
                            objm_ProductPart.ModelNO       = txt_ModelNO.Text.Trim();
                            objm_ProductPart.SerialNo      = txt_SerialNo.Text.Trim();
                            objm_ProductPart.SKU           = txt_SKU.Text.Trim();
                            objm_ProductPart.SuppCode      = "";// txt_SuppCode.Text.Trim();
                            objm_ProductPart.MfctCode      = txt_MfctCode.Text.Trim();
                            objm_ProductPart.UnitOfMeasure = txt_UnitOfMeasure.Text.Trim();
                            objm_ProductPart.Color         = txt_Color.Text.Trim();
                            objm_ProductPart.Brand         = txt_SKU.Text.Trim();
                            objm_ProductPart.Capacity      = "";
                            objm_ProductPart.UnitPrice     = Convert.ToDecimal(txt_UnitPrice.Text.Trim());
                            objm_ProductPart.SellingPrice  = Convert.ToDecimal(txt_SellingPrice.Text.Trim());
                            objm_ProductPart.CostPrice     = Convert.ToDecimal(txt_CostPrice.Text.Trim());
                            objm_ProductPart.AvgPrice      = Convert.ToDecimal(txt_CostPrice.Text.Trim());
                            objm_ProductPart.PackSize      = 0;
                            objm_ProductPart.ReOrderLevel  = 0;
                            objm_ProductPart.MinQty        = 10;
                            objm_ProductPart.EOQty         = 60;
                            objm_ProductPart.ReOrderQty    = 50;
                            objm_ProductPart.ModifyUser    = commonFunctions.Loginuser;
                            objm_ProductPart.ModifyDate    = DateTime.Now;
                            new M_ProductPartDL().Savem_ProductPartSP(objm_ProductPart, 1);

                            scope.Complete();
                        }
                    }
                    GetData();
                    txt_IDX.Enabled = true;
                    FunctionButtonStatus(xEnums.PerformanceType.Save);
                    commonFunctions.SetMDIStatusMessage(UserDefineMessages.Msg_Update_Sucess_string, 2);
                }
                break;

            case xEnums.PerformanceType.Cancel:
                txt_IDX.Enabled = true;
                FunctionButtonStatus(xEnums.PerformanceType.Default);
                errorProvider1.Clear();
                break;
            }
        }