Exemplo n.º 1
0
        public int UpdateS02008(S02008ViewModel model)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateS02008", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value           = model.PONumber;
                cmd.Parameters.Add("VERSIONPOSERA", DbType.Int32).Value       = Convert.ToInt32(model.VersionPOSERA);
                cmd.Parameters.Add("DATAVERSION", DbType.Int32).Value         = Convert.ToInt32(model.DataVersion);
                cmd.Parameters.Add("SALESORDERNO", DbType.String).Value       = model.SalesOrderNo;
                cmd.Parameters.Add("NOCHASIS_INPUT", DbType.String).Value     = model.ChassisNumberByVendor;
                cmd.Parameters.Add("TGLMASUKKAROSERI", DbType.DateTime).Value = model.DateEntryCarrosserieAccessories;
                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
        public int UpdateS02004(S02004ViewModel model)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateS02004", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value        = model.PONumber;
                cmd.Parameters.Add("VERSIONPOSERA", DbType.Int32).Value    = Convert.ToInt32(model.VersionPOSERA);
                cmd.Parameters.Add("DATAVERSION", DbType.Int32).Value      = Convert.ToInt32(model.DataVersion);
                cmd.Parameters.Add("STATUS", DbType.DateTime).Value        = model.Status;
                cmd.Parameters.Add("REASONREJECTION", DbType.String).Value = model.ReasonRejection;
                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
Exemplo n.º 3
0
        public object CustomerQuery(string Sqlstring)
        {
            //string con = "name = EntityFrameworkOracleContext";
            using (EntityConnection econn = new EntityConnection(lbc.GetDataContext().MetadataWorkspace, lbc.GetDataContext().Connection))
            {
                econn.Open();
                EntityCommand ecmd = new EntityCommand(Sqlstring, econn);

                return(ecmd.ExecuteScalar());
            }
        }
Exemplo n.º 4
0
        private object QueryScalar(string connectionString, string commandString)
        {
            var connection = new EntityConnection(connectionString);

            connection.Open();
            var command = new EntityCommand(commandString, connection);
            var result  = command.ExecuteScalar();

            connection.Close();

            return(result);
        }
        public static T ExecuteScalarFunction <T>(this ObjectContext context, string functionImportName, EntityParameter[] parameters)
            where T : struct
        {
            if (functionImportName == null)
            {
                throw new ArgumentNullException("functionName");
            }

            EntityCommand cmd = (EntityCommand)context.Connection.CreateCommand();

            cmd.CommandText = context.DefaultContainerName + "." + functionImportName;
            cmd.CommandType = CommandType.StoredProcedure;
            if (context.CommandTimeout.HasValue)
            {
                cmd.CommandTimeout = context.CommandTimeout.Value;
            }
            if (parameters != null)
            {
                foreach (EntityParameter parameter in parameters)
                {
                    cmd.Parameters.Add(parameter);
                }
            }

            T ret = default(T);

            context.EnsureConnection();
            try
            {
                object o = cmd.ExecuteScalar();
                ret = (T)Convert.ChangeType(o, typeof(T));
            }
            finally
            {
                context.ReleaseConnection();
            }

            return(ret);
        }
Exemplo n.º 6
0
        public int UpdateS02006(S02006ViewModel model)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateS02006", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value       = model.PONumberSERA;
                cmd.Parameters.Add("NOFAKTUR", DbType.String).Value       = model.BillingNo; //mapping to CUSTOMPO.DONUMBER 01NOV2013
                cmd.Parameters.Add("INVNO", DbType.String).Value          = model.KuitansiNo;
                cmd.Parameters.Add("INVDATE", DbType.DateTime).Value      = model.KuitansiDate;
                cmd.Parameters.Add("NOFAKTURPAJAK", DbType.String).Value  = model.NomorFakturPajak;
                cmd.Parameters.Add("NOCHASIS_INPUT", DbType.String).Value = model.ChasisNumber;
                cmd.Parameters.Add("NETPRICE", DbType.Decimal).Value      = model.AmountKuitansiDC;
                //CUSTOM_VENDOR_TRANSACTION
                cmd.Parameters.Add("BUSINESSAREACODE", DbType.String).Value = model.BusinessAreaCode;
                cmd.Parameters.Add("CUSTOMERNO", DbType.String).Value       = model.CustomerNo;
                cmd.Parameters.Add("NOMORSPES", DbType.String).Value        = model.NomorSpes;
                cmd.Parameters.Add("SALESORDERNO", DbType.String).Value     = model.SalesOrderNo;
                cmd.Parameters.Add("SALESMANNUMBER", DbType.String).Value   = model.SalesmanNumber;
                cmd.Parameters.Add("VERSIONPOSERA", DbType.Int32).Value     = Convert.ToInt32(model.VersionPOSERA);
                cmd.Parameters.Add("KUITANSINOREF", DbType.String).Value    = model.KuitansiNoRef;
                cmd.Parameters.Add("KUITANSIDATEREF", DbType.String).Value  = model.KuitansiDateRef;
                cmd.Parameters.Add("DOWNLOADDATE", DbType.DateTime).Value   = model.DownloadDate;
                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
        public string GetKodeCabangAI(string poNumber)
        {
            string result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_GetKodeCabangAI", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value = poNumber;
                OpenConnection();
                result = Convert.ToString(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = "";
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
Exemplo n.º 8
0
        public int UpdateCustomPOStatusPOId(string poNumber, string poStatusId)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateCustomPOStatusPOId", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value   = poNumber;
                cmd.Parameters.Add("POSTATUSID", DbType.String).Value = poStatusId;
                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
Exemplo n.º 9
0
        public int UpdateS02002HS(string poNumber, string HSorIS, S02002ViewModel model)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateS02002_HS", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value = poNumber;
                //CUSTOM_VENDOR_TRANSATION
                cmd.Parameters.Add("VERSIONPOSERA", DbType.Int32).Value            = Convert.ToInt32(model.VersionPOSERA);
                cmd.Parameters.Add("DATAVERSION", DbType.Int32).Value              = Convert.ToInt32(model.DataVersion);
                cmd.Parameters.Add("STATUSPOSERA", DbType.String).Value            = model.StatusPOSERA;
                cmd.Parameters.Add("REJECTREVISEDPOSERA", DbType.String).Value     = model.RejectRevisedPOSERA;
                cmd.Parameters.Add("DOCUMENTNO", DbType.String).Value              = model.DocumentNo;
                cmd.Parameters.Add("AIMATERIALNUMBER", DbType.String).Value        = model.AIMaterialNumber;
                cmd.Parameters.Add("SERAMATERIALNUMBER", DbType.String).Value      = model.SERAMaterialNumber;
                cmd.Parameters.Add("SERAMATERIALDESCRIPTION", DbType.String).Value = model.SERAMaterialDescription;
                cmd.Parameters.Add("AICOLOR", DbType.String).Value     = model.AIColor;
                cmd.Parameters.Add("SERACOLOR", DbType.String).Value   = model.SERAColor;
                cmd.Parameters.Add("QUOTATIONNO", DbType.String).Value = model.QuotationNo;
                //cmd.Parameters.Add("HSORIS", DbType.String).Value = HSorIS;
                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }
Exemplo n.º 10
0
        public int UpdateS02002IS(string poNumber, string HSorIS, S02002ViewModel model)
        {
            int result;

            try
            {
                EntityCommand cmd = new EntityCommand("EProcEntities.sp_UpdateS02002_IS", entityConnection);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("PONUMBER", DbType.String).Value           = poNumber;
                cmd.Parameters.Add("HARGADPP_INPUT", DbType.Double).Value     = model.DPPByVendor;
                cmd.Parameters.Add("HARGAPPNUNIT_INPUT", DbType.Double).Value = model.PPNByVendor;
                cmd.Parameters.Add("HARGABBN_INPUT", DbType.Double).Value     = model.BBNPriceByVendor;
                // cmd.Parameters.Add("CBUCKD", DbType.String).Value = model.CBUCKD;// tidak ada di table
                cmd.Parameters.Add("DONUMBER", DbType.String).Value = model.FactureDONumber;
                cmd.Parameters.Add("DODATE", DbType.DateTime).Value = model.FactureDODate;
                cmd.Parameters.Add("ACTUALDATEDELIVEREDUNIT", DbType.DateTime).Value = model.ActualDateDeliveryUnit;
                cmd.Parameters.Add("NOCHASIS_INPUT", DbType.String).Value            = model.ChassisNumberByVendor;
                cmd.Parameters.Add("NOENGINE_INPUT", DbType.String).Value            = model.MachineNumberByVendor;
                cmd.Parameters.Add("NOFAKTUR", DbType.String).Value                       = model.NoFakturKendaraan;
                cmd.Parameters.Add("TGLFAKTUR", DbType.DateTime).Value                    = model.TanggalFakturKendaraan;
                cmd.Parameters.Add("NOPOLISI_INPUT", DbType.String).Value                 = model.LicensePlateByVendor;
                cmd.Parameters.Add("TGLSTNK_INPUT", DbType.DateTime).Value                = model.STNKDateByVendor;
                cmd.Parameters.Add("NOSERTIFIKAT", DbType.String).Value                   = model.NoSertifikat;
                cmd.Parameters.Add("TGLSERTIFIKAT", DbType.DateTime).Value                = model.TglSertifikat;
                cmd.Parameters.Add("NOFORMULIRA", DbType.String).Value                    = model.NoFormulirA;
                cmd.Parameters.Add("TGLFORMULIRA", DbType.DateTime).Value                 = model.TglFormulirA;
                cmd.Parameters.Add("NOSERTIFIKATREGUJITIPE", DbType.String).Value         = model.NoSertifikatRegUjiTipe;
                cmd.Parameters.Add("DATEDELIVERYTOBRANCHORVENDOR", DbType.DateTime).Value = model.ActualDeliveryBPKBDate;
                cmd.Parameters.Add("NOBPKB", DbType.String).Value       = model.BPKBNumber;
                cmd.Parameters.Add("KETBPKB", DbType.String).Value      = model.RemarksBPKB;
                cmd.Parameters.Add("REVISEDATE", DbType.DateTime).Value = model.RevisiBPKB;
                ////CUSTOM_VENDOR_TRANSATION
                //cmd.Parameters.Add("VERSIONPOSERA", DbType.Int32).Value = model.VersionPOSERA;
                //cmd.Parameters.Add("DATAVERSION", DbType.Int32).Value = model.DataVersion;
                //cmd.Parameters.Add("STATUSPOSERA", DbType.String).Value = model.StatusPOSERA;
                //cmd.Parameters.Add("REJECTREVISEDPOSERA", DbType.String).Value = model.RejectRevisedPOSERA;
                //cmd.Parameters.Add("DOCUMENTNO", DbType.String).Value = model.DocumentNo;
                //cmd.Parameters.Add("AIMATERIALNUMBER", DbType.String).Value = model.AIMaterialNumber;
                //cmd.Parameters.Add("SERAMATERIALNUMBER", DbType.String).Value = model.SERAMaterialNumber;
                //cmd.Parameters.Add("SERAMATERIALDESCRIPTION", DbType.String).Value = model.SERAMaterialDescription;
                //cmd.Parameters.Add("AICOLOR", DbType.String).Value = model.AIColor;
                //cmd.Parameters.Add("SERACOLOR", DbType.String).Value = model.SERAColor;
                //cmd.Parameters.Add("QUOTATIONNO", DbType.String).Value = model.QuotationNo;
                cmd.Parameters.Add("SALESORDERNO", DbType.String).Value      = model.SalesOrderNo;
                cmd.Parameters.Add("SALESORDERSTATUS", DbType.Boolean).Value = model.SalesOrderStatus;
                cmd.Parameters.Add("CURRENCY", DbType.String).Value          = model.Currency;
                cmd.Parameters.Add("YEAR", DbType.Int32).Value            = model.Year;
                cmd.Parameters.Add("BILLINGSTATUS", DbType.Boolean).Value = model.BillingStatus;
                cmd.Parameters.Add("BSTKBNO", DbType.String).Value        = model.BSTKBNo;
                cmd.Parameters.Add("REVISISTNK", DbType.DateTime).Value   = model.RevisiSTNK;
                cmd.Parameters.Add("NAMAPENERIMA", DbType.String).Value   = model.NamaPenerima;
                cmd.Parameters.Add("ALAMATPENERIMA", DbType.String).Value = model.AlamatPenerima;
                //cmd.Parameters.Add("HSORIS", DbType.String).Value = HSorIS;

                OpenConnection();
                result = Convert.ToInt32(cmd.ExecuteScalar());
            }
            catch (Exception ex)
            {
                result = 0;
                throw ex;
            }
            finally
            {
                CloseConnection();
            }
            return(result);
        }