Ejemplo n.º 1
0
        public ICollection <ProductMaster> colGetProductMaster(string argClientCode)
        {
            List <ProductMaster> lst     = new List <ProductMaster>();
            DataSet       DataSetToFill  = new DataSet();
            ProductMaster tProductMaster = new ProductMaster();

            DataSetToFill = this.GetProductMaster(argClientCode);

            if (DataSetToFill != null)
            {
                foreach (DataRow dr in DataSetToFill.Tables[0].Rows)
                {
                    lst.Add(objCreateProductMaster(dr));
                }
            }
            goto Finish;

Finish:
            DataSetToFill = null;


            return(lst);
        }
Ejemplo n.º 2
0
        public void UpdateProductMaster(ProductMaster argProductMaster, DataAccess da, List <ErrorHandler> lstErr)
        {
            SqlParameter[] param = new SqlParameter[36];
            param[0] = new SqlParameter("@SerialNo", argProductMaster.SerialNo);
            param[1] = new SqlParameter("@MastSerialNo", argProductMaster.MastSerialNo);
            param[2] = new SqlParameter("@MastMaterialCode", argProductMaster.MastMaterialCode);
            param[3] = new SqlParameter("@MRevisionCode", argProductMaster.MRevisionCode);
            param[4] = new SqlParameter("@CompanyCode", argProductMaster.CompanyCode);
            param[5] = new SqlParameter("@MaterialCode", argProductMaster.MaterialCode);
            param[6] = new SqlParameter("@MatGroup1Code", argProductMaster.MatGroup1Code);
            param[7] = new SqlParameter("@WarrantyCode", argProductMaster.WarrantyCode);
            param[8] = new SqlParameter("@ManufacturingDate", argProductMaster.ManufacturingDate);

            param[9] = new SqlParameter("@PrimarySalesDate", argProductMaster.PrimarySalesDate);

            param[10] = new SqlParameter("@CustInvoiceDate", argProductMaster.CustInvoiceDate);
            param[11] = new SqlParameter("@CustInvoiceNo", argProductMaster.CustInvoiceNo);
            param[12] = new SqlParameter("@CustType", argProductMaster.CustType);
            param[13] = new SqlParameter("@CustName", argProductMaster.CustName);
            param[14] = new SqlParameter("@CustAddress1", argProductMaster.CustAddress1);
            param[15] = new SqlParameter("@CustAddress2", argProductMaster.CustAddress2);
            param[16] = new SqlParameter("@CustPhone", argProductMaster.CustPhone);
            param[17] = new SqlParameter("@CustMobile", argProductMaster.CustMobile);
            param[18] = new SqlParameter("@CustEmail", argProductMaster.CustEmail);
            param[19] = new SqlParameter("@CustGender", argProductMaster.CustGender);
            param[20] = new SqlParameter("@WarrantyOn", argProductMaster.WarrantyOn);
            param[21] = new SqlParameter("@ExtWarrantyOn", argProductMaster.ExtWarrantyOn);
            param[22] = new SqlParameter("@ExtWarrantyReason", argProductMaster.ExtWarrantyReason);
            param[23] = new SqlParameter("@ValidFrom", argProductMaster.ValidFrom);
            param[24] = new SqlParameter("@ValidTo", argProductMaster.ValidTo);
            param[25] = new SqlParameter("@ExtValidFrom", argProductMaster.ExtValidFrom);
            param[26] = new SqlParameter("@ExtValidTo", argProductMaster.ExtValidTo);
            param[27] = new SqlParameter("@IsExtWarrantyApp", argProductMaster.IsExtWarrantyApp);
            param[28] = new SqlParameter("@IsWarrantyExp", argProductMaster.IsWarrantyExp);
            param[29] = new SqlParameter("@IsAbandoned", argProductMaster.IsAbandoned);
            param[30] = new SqlParameter("@ClientCode", argProductMaster.ClientCode);
            param[31] = new SqlParameter("@CreatedBy", argProductMaster.CreatedBy);
            param[32] = new SqlParameter("@ModifiedBy", argProductMaster.ModifiedBy);

            param[33]           = new SqlParameter("@Type", SqlDbType.Char);
            param[33].Size      = 1;
            param[33].Direction = ParameterDirection.Output;

            param[34]           = new SqlParameter("@Message", SqlDbType.VarChar);
            param[34].Size      = 255;
            param[34].Direction = ParameterDirection.Output;

            param[35]           = new SqlParameter("@returnvalue", SqlDbType.VarChar);
            param[35].Size      = 20;
            param[35].Direction = ParameterDirection.Output;

            int i = da.NExecuteNonQuery("Proc_UpdateProductMaster", param);


            string strMessage  = Convert.ToString(param[34].Value);
            string strType     = Convert.ToString(param[33].Value);
            string strRetValue = Convert.ToString(param[35].Value);


            objErrorHandler.Type        = strType;
            objErrorHandler.MsgId       = 0;
            objErrorHandler.Module      = ErrorConstant.strInsertModule;
            objErrorHandler.ModulePart  = ErrorConstant.strMasterModule;
            objErrorHandler.Message     = strMessage.ToString();
            objErrorHandler.RowNo       = 0;
            objErrorHandler.FieldName   = "";
            objErrorHandler.LogCode     = "";
            objErrorHandler.ReturnValue = strRetValue;
            lstErr.Add(objErrorHandler);
        }
Ejemplo n.º 3
0
        public ICollection <ErrorHandler> SaveProductMaster(ProductMaster argProductMaster)
        {
            List <ErrorHandler> lstErr = new List <ErrorHandler>();
            DataAccess          da     = new DataAccess();

            try
            {
                if (blnIsProductMasterExists(argProductMaster.SerialNo, argProductMaster.MatGroup1Code, argProductMaster.ClientCode) == false)
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    InsertProductMaster(argProductMaster, ref da, ref lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
                else
                {
                    da.Open_Connection();
                    da.BEGIN_TRANSACTION();
                    UpdateProductMaster(argProductMaster, da, lstErr);
                    foreach (ErrorHandler objerr in lstErr)
                    {
                        if (objerr.Type == "E")
                        {
                            da.ROLLBACK_TRANSACTION();
                            return(lstErr);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                if (da != null)
                {
                    da.ROLLBACK_TRANSACTION();
                }
                objErrorHandler.Type       = ErrorConstant.strAboartType;
                objErrorHandler.MsgId      = 0;
                objErrorHandler.Module     = ErrorConstant.strInsertModule;
                objErrorHandler.ModulePart = ErrorConstant.strMasterModule;
                objErrorHandler.Message    = ex.Message.ToString();
                objErrorHandler.RowNo      = 0;
                objErrorHandler.FieldName  = "";
                objErrorHandler.LogCode    = "";
                lstErr.Add(objErrorHandler);
            }
            finally
            {
                if (da != null)
                {
                    da.Close_Connection();
                    da = null;
                }
            }
            return(lstErr);
        }