Ejemplo n.º 1
0
        public string ApproveConditionalQuotation(string QuotationNo, string Comment, string VersionNo, string ApprovedBy, string InquiryNo)
        {
            string result = "Error Approving Quotation";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Approve_Quotation";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Action", "Conditional Quotation Approved");
                cmd.Parameters.AddWithValue("@QuotationNo", QuotationNo);
                cmd.Parameters.AddWithValue("@InquiryNo", InquiryNo);
                cmd.Parameters.AddWithValue("@VersionNo", VersionNo);
                cmd.Parameters.AddWithValue("@Filestatus", InquiryStatus.ConditionalQuotationApproved);
                cmd.Parameters.AddWithValue("@ApprovedBy", ApprovedBy);
                cmd.Parameters.AddWithValue("@Comment", Comment);
                cmd.Parameters.AddWithValue("@ApprovalDate", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Quotation Approved Conditionally!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
Ejemplo n.º 2
0
        public string UpdateCurrencyExchangeRate(ACRF_CurrencyExchangeRateModel objModel)
        {
            string result = "Error on Updating Currency Exchange Rate!";

            try
            {
                result = CheckIfCurrencyExchangeRateExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_CurrencyExchangeRate set FCountryId=@FCountryId,FCurrency=@FCurrency"
                                 + ", FCurrencyCode=@FCurrencyCode, Unit=@Unit, ImportRate=@ImportRate, ExportRate=@ExportRate,"
                                 + " UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn where Id=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@FCountryId", objModel.FCountryId);
                        cmd.Parameters.AddWithValue("@FCurrency", objModel.FCurrency);
                        cmd.Parameters.AddWithValue("@FCurrencyCode", objModel.FCurrencyCode);
                        cmd.Parameters.AddWithValue("@Unit", objModel.Unit);
                        cmd.Parameters.AddWithValue("@ImportRate", objModel.ImportRate);
                        cmd.Parameters.AddWithValue("@ExportRate", objModel.ExportRate);
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Currency Exchange Rate Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 3
0
        public string ConditionalApprovedPurchaseOrder(string PONo, string Comment, string ApprovedBy)
        {
            string result = "Error Rejecting Vendor PO";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "uspConditionalapproved_VendorPO";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@PONo", PONo);
                cmd.Parameters.AddWithValue("@vendor_po_status", "ConditionalApproved");
                cmd.Parameters.AddWithValue("@ApprovedBy", ApprovedBy);
                cmd.Parameters.AddWithValue("@Comment", Comment);
                cmd.Parameters.AddWithValue("@ApprovalDate", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Vendor PO Rejected Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
Ejemplo n.º 4
0
        public string InsertConsumableIssued(ssmtbl_ConsumablesIssuedModel objConsumeMod)
        {
            string result = "Error Inserting ConsumableIssued";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Get_AllConsumableIssuedList";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Code", objConsumeMod.Code);
                cmd.Parameters.AddWithValue("@IssuedTo", objConsumeMod.IssuedTo);
                cmd.Parameters.AddWithValue("@IssuedDate", objConsumeMod.IssuedDate);
                cmd.Parameters.AddWithValue("@IssuedQuantity", objConsumeMod.IssuedQuantity);
                cmd.Parameters.AddWithValue("@IssuedBy", objConsumeMod.IssuedBy);
                cmd.Parameters.AddWithValue("@Flag ", "1");
                cmd.Parameters.AddWithValue("@CreatedBy", objConsumeMod.CreatedBy);
                cmd.Parameters.AddWithValue("@CreatedDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@UpdatedBy", objConsumeMod.UpdatedBy);
                cmd.Parameters.AddWithValue("@UpdatedDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@Description ", objConsumeMod.Description);
                cmd.Parameters.AddWithValue("@Action ", "insert");

                cmd.ExecuteNonQuery();
                connection.Close();
                result = "ConsumableIssued Created Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
        public string RejectPurchaseOrder(string PO_Id, string InquiryNo, string ApprovedBy, string Comment)
        {
            string result = "Error Rejecting Purchase Orbder";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Reject_PurchaseOrder";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@InquiryNo", InquiryNo);
                cmd.Parameters.AddWithValue("@Filestatus", InquiryStatus.PORejected);
                cmd.Parameters.AddWithValue("@ApprovedBy", ApprovedBy);
                cmd.Parameters.AddWithValue("@Comment", Comment);
                cmd.Parameters.AddWithValue("@ApprovalDate", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Purchase Order Rejected Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
        public ssmtbl_VendorPurchaseOrderModel GetMaxPONo()
        {
            ssmtbl_VendorPurchaseOrderModel objPOModel = new ssmtbl_VendorPurchaseOrderModel();

            try
            {
                string sqlstr     = "select (Isnull(Max(po_id),0) + 1) as po_id from dbo.ssmtbl_VendorPurchaseOrder";
                var    connection = gConnection.Connection();
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlstr, connection);
                cmd.CommandType = CommandType.Text;
                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    objPOModel.po_id   = Convert.ToInt32(sdr["po_id"].ToString());
                    objPOModel.po_char = "VPO-" + StandardDateTime.GetDateTime().ToString("MMyy") + "-";
                    objPOModel.po_no   = objPOModel.po_char + objPOModel.po_id;

                    objPOModel.quotation_ref_date = StandardDateTime.GetDateTime();
                    objPOModel.po_date            = StandardDateTime.GetDateTime();
                    objPOModel.valid_date         = StandardDateTime.GetDateTime();
                }
                connection.Close();
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(objPOModel);
        }
Ejemplo n.º 7
0
        public string UpdateAirports(ACRF_AirportsModel objModel)
        {
            string result = "Error on Updating Airports!";

            try
            {
                result = CheckIfAirportsExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_Airports set Airports=@Airports, ShortCode=@ShortCode, CountryId=@CountryId,"
                                 + " UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn where Id=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Airports", objModel.Airports);
                        cmd.Parameters.AddWithValue("@ShortCode", objModel.ShortCode);
                        cmd.Parameters.AddWithValue("@CountryId", objModel.CountryId);
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Airports Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 8
0
        public string DeleteAirlines(int Id, string CreatedBy)
        {
            string result = "Error on Deleting Airlines!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "insert into ACRF_Airlines_Log(Id,AirlineCode,SubCode,AirlineName,HQAddress,HQPhone,HQFAX,HQEmail,HQIATAMember,"
                             + " SalGsaCsaName,SalAddress,SalPhone,SalFAX,SalEmail,OprAddress,OprPhone,OprFAX,OprEmail,CreatedBy,CreatedOn)"
                             + " Select Id,AirlineCode,SubCode,AirlineName,HQAddress,HQPhone,HQFAX,HQEmail,HQIATAMember,"
                             + " SalGsaCsaName,SalAddress,SalPhone,SalFAX,SalEmail,OprAddress,OprPhone,OprFAX,OprEmail, "
                             + " @CreatedBy,@CreatedOn from ACRF_Airlines where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.Parameters.AddWithValue("@CreatedBy", CreatedBy);
                    cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    sqlstr          = "delete from ACRF_Airlines where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.ExecuteNonQuery();



                    transaction.Commit();
                    connection.Close();
                    result = "Airlines Deleted Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
        public void TimeElapsedInYearsSince_InvalidGameDate_ReturnZero()
        {
            //ARRANGE
            StandardDateTime time = new StandardDateTime(new System.DateTime(5196, 7, 11));
            //ACT
            long days = time.TimeElapsedInYearsSince(new CustomDateTime(5196, 11, 1));

            //ASSERT
            Assert.AreEqual(0, days);
        }
        public void TimeElapsedInDaysSince_ValidGameDate_ReturnCorrectNumberOfDays()
        {
            //ARRANGE
            StandardDateTime time = new StandardDateTime(new System.DateTime(5196, 9, 1));
            //ACT
            long days = time.TimeElapsedInDaysSince(new StandardDateTime(new System.DateTime(5196, 11, 1, 1, 2, 0)));

            //ASSERT
            Assert.AreEqual(61, days);
        }
Ejemplo n.º 11
0
        public string DeleteDestinationMaster(int Id, string CreatedBy)
        {
            string result = "Error on Deleting Destination Master!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "insert into ACRF_DestinationMaster_Log(Id,CityCode,CityName,CountryCode,CountryName,TimeDifference, "
                             + " CustomAirport,AirportName,ISDCode,Currency,State,IATAArea,CreatedBy,CreatedOn)"
                             + " Select Id,CityCode,CityName,CountryCode,CountryName,TimeDifference, "
                             + " CustomAirport,AirportName,ISDCode,Currency,State,IATAArea,@CreatedBy,@CreatedOn from ACRF_DestinationMaster where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.Parameters.AddWithValue("@CreatedBy", CreatedBy);
                    cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    sqlstr          = "delete from ACRF_DestinationMaster where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.ExecuteNonQuery();



                    transaction.Commit();
                    connection.Close();
                    result = "Destination Master Deleted Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
        public string DeleteCustomerDetails(int id, string created_by)
        {
            string result = "Error on Deleting Customer Details!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "insert into ACRF_CustomerDetails_Log(Id, CustomerName, VendorId,Address,ContactName,Mobile,Email,FAX,SkypeId,Website,MiscInfo "
                             + " ,Password,CountryId,PostalCode,CreatedBy,CreatedOn) "
                             + " select Id, CustomerName, VendorId,Address,ContactName,Mobile,Email,FAX,SkypeId,Website,MiscInfo "
                             + " ,Password,CountryId,PostalCode,@CreatedBy,@CreatedOn from ACRF_CustomerDetails where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", id);
                    cmd.Parameters.AddWithValue("@CreatedBy", created_by);
                    cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    sqlstr          = "delete from ACRF_CustomerDetails where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", id);
                    cmd.ExecuteNonQuery();


                    transaction.Commit();
                    connection.Close();
                    result = "Customer Details Deleted Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 13
0
        public string UpdateVendorLoginPassword(adminLoginPasswordModel objModel)
        {
            string result = "Error on updating vendor login password!";

            try
            {
                bool chkres = CheckIfVendorExists(objModel);
                if (chkres == true)
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_VendorDetails set Password=@Password, "
                                 + " UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn where Id=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);
                        cmd.Parameters.AddWithValue("@Password", Encryption.encrypt(objModel.new_password));
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Vendor Login Password Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    result = "Enter Valid Old Password";
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 14
0
        public string DeleteVendorDetails(int id, string created_by)
        {
            string result = "Error on Deleting Project Details!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "insert into ProjectDetails_Log(ProjectName,ManagerName,Mobile,Email,SkypeId"
                             + " ,Password,CreatedBy,CreatedOn,SprintStartDate,SprintEndDate,CurrentSprintName,Devhours,Testhours) "
                             + " select ProjectName,ManagerName,Mobile,Email,SkypeId"
                             + " ,Password,CreatedBy,CreatedOn,SprintStartDate,SprintEndDate,CurrentSprintName,Devhours,Testhours from ProjectDetails where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", id);
                    cmd.Parameters.AddWithValue("@CreatedBy", created_by);
                    cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    sqlstr          = "delete from ProjectDetails where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", id);
                    cmd.ExecuteNonQuery();


                    transaction.Commit();
                    connection.Close();
                    result = "Project Deleted Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 15
0
        public string DeleteTariffMode(int Id, string CreatedBy)
        {
            string result = "Error on Deleting Tariff Mode!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "insert into ACRF_TariffMode_Log(Id,TariffMode,CreatedBy,CreatedOn) Select Id, "
                             + " TariffMode,@CreatedBy,@CreatedOn from ACRF_TariffMode where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.Parameters.AddWithValue("@CreatedBy", CreatedBy);
                    cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    sqlstr          = "delete from ACRF_TariffMode where Id=@Id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@Id", Id);
                    cmd.ExecuteNonQuery();



                    transaction.Commit();
                    connection.Close();
                    result = "Tariff Mode Deleted Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 16
0
        public string CreateCountry(ACRF_CountryModel objModel)
        {
            string result = "Error on Saving Country!";

            try
            {
                result = CheckIfCountryExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr          = "insert into ACRF_Country(Country,CreatedBy,CreatedOn) values (@Country,@CreatedBy,@CreatedOn)";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Country", objModel.Country);
                        cmd.Parameters.AddWithValue("@CreatedBy", objModel.CreatedBy);
                        cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Country Added Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 17
0
        public string UpdateAdminProfileImage(int adminId, string attachment_path)
        {
            string result = "Error on Uploading Profile Image";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr = "update ACRF_AdminDetails set  ProfilePicture=@ProfilePicture, updatedon=@updatedon "
                             + " where id=@id";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@id", adminId);
                    cmd.Parameters.AddWithValue("@ProfilePicture", attachment_path);

                    cmd.Parameters.AddWithValue("@updatedon", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();


                    transaction.Commit();
                    connection.Close();
                    result = "Profile Image Updated Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 18
0
        public string UpdateQuotationStatus(QuotationStatusModel objModel)
        {
            string result = "Error on Updating Quotation Status!";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand     cmd = connection.CreateCommand();
                SqlTransaction transaction;
                transaction     = connection.BeginTransaction();
                cmd.Transaction = transaction;
                cmd.Connection  = connection;
                try
                {
                    string sqlstr = "";
                    sqlstr          = "update ACRF_Quotation set QuotationStatus=@QuotationStatus,UpdatedOn=@UpdatedOn,UpdatedBy=@UpdatedBy";
                    sqlstr          = sqlstr + "  where QuotationId=@QuotationId ";
                    cmd.CommandText = sqlstr;
                    cmd.Parameters.Clear();
                    cmd.Parameters.AddWithValue("@QuotationStatus", objModel.QuotationStatus);
                    cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                    cmd.Parameters.AddWithValue("@QuotationId", objModel.QuotationId);
                    cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                    cmd.ExecuteNonQuery();

                    transaction.Commit();
                    connection.Close();
                    result = "Quotation Status Updated Successfully!";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                    connection.Close();
                    Global.ErrorHandlerClass.LogError(ex);
                    result = ex.Message;
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 19
0
        public string UpdateAdminProfile(ACRF_AdminDetailsModel objModel)
        {
            string result = "Error! Profile not updated;";

            try
            {
                string sqlstr = " update ACRF_AdminDetails set AdminName=@AdminName,Address=@Address,ContactName=@ContactName,Mobile=@Mobile,"
                                + " Email=@Email,FAX=@FAX,SkypeId=@SkypeId,MiscInfo=@MiscInfo,Password=@Password,CountryId=@CountryId, "
                                + " PostalCode=@PostalCode,UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn where Id=@Id";

                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlstr, connection);
                cmd.Parameters.AddWithValue("@AdminName", objModel.AdminName);
                cmd.Parameters.AddWithValue("@Address", objModel.Address);
                cmd.Parameters.AddWithValue("@ContactName", objModel.ContactName);
                cmd.Parameters.AddWithValue("@Mobile", objModel.Mobile);
                cmd.Parameters.AddWithValue("@Email", objModel.Email);
                cmd.Parameters.AddWithValue("@FAX", objModel.FAX);
                cmd.Parameters.AddWithValue("@SkypeId", objModel.SkypeId);
                cmd.Parameters.AddWithValue("@MiscInfo", objModel.MiscInfo);
                cmd.Parameters.AddWithValue("@Password", Encryption.encrypt(objModel.Password));
                cmd.Parameters.AddWithValue("@CountryId", objModel.CountryId);
                cmd.Parameters.AddWithValue("@PostalCode", objModel.PostalCode);
                cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                cmd.Parameters.AddWithValue("@Id", objModel.Id);
                cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();


                result = "Profile Updated Successfully!";
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 20
0
        public string InsertConsumables(ssmtbl_ConsumableModel objConsumableMod)
        {
            string result = "Error Inserting Consumables";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Lkp_Consumables";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@Code", objConsumableMod.Code);
                cmd.Parameters.AddWithValue("@Description", objConsumableMod.Description);
                cmd.Parameters.AddWithValue("@Specification", objConsumableMod.Specification);
                cmd.Parameters.AddWithValue("@Applicationcenter_CostCenter", objConsumableMod.Applicationcenter_CostCenter);
                cmd.Parameters.AddWithValue("@Rate", objConsumableMod.Rate);
                cmd.Parameters.AddWithValue("@StorageLevelMin", objConsumableMod.StorageLevelMin);
                cmd.Parameters.AddWithValue("@MaxQunatity", objConsumableMod.MaxQunatity);
                cmd.Parameters.AddWithValue("@BalanceQunatity", objConsumableMod.BalanceQunatity);
                cmd.Parameters.AddWithValue("@Flag", objConsumableMod.Flag);
                cmd.Parameters.AddWithValue("@CreatedBy", objConsumableMod.CreatedBy);
                cmd.Parameters.AddWithValue("@CreatedDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@UpdatedBy", objConsumableMod.UpdatedBy);
                cmd.Parameters.AddWithValue("@UpdatedDate", objConsumableMod.UpdatedDate);
                cmd.Parameters.AddWithValue("@Units", objConsumableMod.Units);
                cmd.Parameters.AddWithValue("@OpeningStock", objConsumableMod.OpeningStock);
                cmd.Parameters.AddWithValue("@OpeningDate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@Action ", "insert");

                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Consumables Created Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
Ejemplo n.º 21
0
        public string UpdateLastLogin(string UserType, int id)
        {
            string result = "";

            try
            {
                string sqlstr = " ";

                if (UserType == ACRF_WebAPI.Global.UserType.AdminUser)
                {
                    sqlstr = "update ACRF_AdminDetails set LastLogin=@LastLogin where ID=@Id ";
                }
                else if (UserType == ACRF_WebAPI.Global.UserType.VendorUser)
                {
                    sqlstr = "update ACRF_VendorDetails set LastLogin=@LastLogin where ID=@Id ";
                }
                else if (UserType == ACRF_WebAPI.Global.UserType.EmployeeUser)
                {
                    sqlstr = "update ACRF_EmployeeDetails set LastLogin=@LastLogin where ID=@Id ";
                }

                var connection = gConnection.Connection();
                connection.Open();
                SqlCommand cmd = new SqlCommand(sqlstr, connection);
                cmd.Parameters.AddWithValue("@Id", id);
                cmd.Parameters.AddWithValue("@LastLogin", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 22
0
        public string UpdateAirlines(ACRF_AirlinesModel objModel)
        {
            string result = "Error on Updating Airlines!";

            try
            {
                objModel = NullToBlank(objModel);
                result   = CheckIfAirlinesExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "update ACRF_Airlines set AirlineCode=@AirlineCode,SubCode=@SubCode,AirlineName=@AirlineName,HQAddress=@HQAddress,"
                                        + " HQPhone=@HQPhone,HQFAX=@HQFAX,HQEmail=@HQEmail,HQIATAMember=@HQIATAMember,SalGsaCsaName=@SalGsaCsaName,SalAddress=@SalAddress,"
                                        + " SalPhone=@SalPhone,SalFAX=@SalFAX,SalEmail=@SalEmail,OprAddress=@OprAddress,OprPhone=@OprPhone,OprFAX=@OprFAX,OprEmail=@OprEmail,"
                                        + " UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn where Id=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@AirlineCode", objModel.AirlineCode);
                        cmd.Parameters.AddWithValue("@SubCode", objModel.SubCode);
                        cmd.Parameters.AddWithValue("@AirlineName", objModel.AirlineName);
                        cmd.Parameters.AddWithValue("@HQAddress", objModel.HQAddress);
                        cmd.Parameters.AddWithValue("@HQPhone", objModel.HQPhone);
                        cmd.Parameters.AddWithValue("@HQFAX", objModel.HQFAX);
                        cmd.Parameters.AddWithValue("@HQEmail", objModel.HQEmail);
                        cmd.Parameters.AddWithValue("@HQIATAMember", objModel.HQIATAMember);
                        cmd.Parameters.AddWithValue("@SalGsaCsaName", objModel.SalGsaCsaName);
                        cmd.Parameters.AddWithValue("@SalAddress", objModel.SalAddress);
                        cmd.Parameters.AddWithValue("@SalPhone", objModel.SalPhone);
                        cmd.Parameters.AddWithValue("@SalFAX", objModel.SalFAX);
                        cmd.Parameters.AddWithValue("@SalEmail", objModel.SalEmail);
                        cmd.Parameters.AddWithValue("@OprAddress", objModel.OprAddress);
                        cmd.Parameters.AddWithValue("@OprPhone", objModel.OprPhone);
                        cmd.Parameters.AddWithValue("@OprFAX", objModel.OprFAX);
                        cmd.Parameters.AddWithValue("@OprEmail", objModel.OprEmail);
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);

                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Airlines Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 23
0
        public string InsertPurchaseOrder(ssmtbl_Quotation_PoModel objPOMod)
        {
            string result = "Error Creating Purchase Order";

            try
            {
                if (objPOMod.ssmtbl_PurchaseOrderModel.Filepath == null)
                {
                    objPOMod.ssmtbl_PurchaseOrderModel.Filepath = "";
                }
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Insert_PurchaseOrder";
                SqlCommand cmd    = new SqlCommand(sqlstr, connection);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@InquiryNo", objPOMod.ssmtbl_QuotationModel.InquiryNo);
                cmd.Parameters.AddWithValue("@customerName", objPOMod.ssmtbl_QuotationModel.CustomerName.Trim());
                cmd.Parameters.AddWithValue("@QuotationNo", objPOMod.ssmtbl_QuotationModel.QuotationNo.Trim());
                cmd.Parameters.AddWithValue("@QuotationId", objPOMod.ssmtbl_QuotationModel.id);
                cmd.Parameters.AddWithValue("@CustomerPONo", objPOMod.ssmtbl_PurchaseOrderModel.CustomerPONo.Trim());
                cmd.Parameters.AddWithValue("@POValidity", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@QtymentionedinPO", objPOMod.ssmtbl_PurchaseOrderModel.QtymentionedinPO.Trim());
                cmd.Parameters.AddWithValue("@DieNumber", objPOMod.ssmtbl_PurchaseOrderModel.DieNumber.Trim());
                cmd.Parameters.AddWithValue("@HSNCode", "");
                cmd.Parameters.AddWithValue("@SteelCost", objPOMod.ssmtbl_PurchaseOrderModel.SteelCost);
                cmd.Parameters.AddWithValue("@Transportation", objPOMod.ssmtbl_PurchaseOrderModel.Transportation);
                cmd.Parameters.AddWithValue("@Total", objPOMod.ssmtbl_PurchaseOrderModel.Total);
                cmd.Parameters.AddWithValue("@TotalRowMaterialCost", objPOMod.ssmtbl_PurchaseOrderModel.TotalRowMaterialCost);
                cmd.Parameters.AddWithValue("@CuttingSquare1", objPOMod.ssmtbl_PurchaseOrderModel.CuttingSquare1);
                cmd.Parameters.AddWithValue("@CuttingSquare2", objPOMod.ssmtbl_PurchaseOrderModel.CuttingSquare2);
                cmd.Parameters.AddWithValue("@Forging1", objPOMod.ssmtbl_PurchaseOrderModel.Forging1);
                cmd.Parameters.AddWithValue("@Forging2", objPOMod.ssmtbl_PurchaseOrderModel.Forging2);
                cmd.Parameters.AddWithValue("@HeatTreatment1", objPOMod.ssmtbl_PurchaseOrderModel.HeatTreatment1);
                cmd.Parameters.AddWithValue("@HeatTreatment2", objPOMod.ssmtbl_PurchaseOrderModel.HeatTreatment2);
                cmd.Parameters.AddWithValue("@ShotBlasting1", objPOMod.ssmtbl_PurchaseOrderModel.ShotBlasting1);
                cmd.Parameters.AddWithValue("@ShotBlasting2", objPOMod.ssmtbl_PurchaseOrderModel.ShotBlasting2);
                cmd.Parameters.AddWithValue("@MPI1", objPOMod.ssmtbl_PurchaseOrderModel.MPI1);
                cmd.Parameters.AddWithValue("@MPI2", objPOMod.ssmtbl_PurchaseOrderModel.MPI2);
                cmd.Parameters.AddWithValue("@Grinding1", objPOMod.ssmtbl_PurchaseOrderModel.Grinding1);
                cmd.Parameters.AddWithValue("@Grinding2", objPOMod.ssmtbl_PurchaseOrderModel.Grinding2);
                cmd.Parameters.AddWithValue("@ColdCoining1", objPOMod.ssmtbl_PurchaseOrderModel.ColdCoining1);
                cmd.Parameters.AddWithValue("@ColdCoining2", objPOMod.ssmtbl_PurchaseOrderModel.ColdCoining2);
                cmd.Parameters.AddWithValue("@Machining1", objPOMod.ssmtbl_PurchaseOrderModel.Machining1);
                cmd.Parameters.AddWithValue("@Machining2", objPOMod.ssmtbl_PurchaseOrderModel.Machining2);
                cmd.Parameters.AddWithValue("@DieMaintenance1", objPOMod.ssmtbl_PurchaseOrderModel.DieMaintenance1);
                cmd.Parameters.AddWithValue("@DieMaintenance2", objPOMod.ssmtbl_PurchaseOrderModel.DieMaintenance2);
                cmd.Parameters.AddWithValue("@TotalConverstionCost", objPOMod.ssmtbl_PurchaseOrderModel.TotalConverstionCost);
                cmd.Parameters.AddWithValue("@TotalComponentCost", objPOMod.ssmtbl_PurchaseOrderModel.TotalComponentCost);
                cmd.Parameters.AddWithValue("@InitialDieCost", objPOMod.ssmtbl_PurchaseOrderModel.InitialDieCost);
                cmd.Parameters.AddWithValue("@Filepath", objPOMod.ssmtbl_PurchaseOrderModel.Filepath);
                cmd.Parameters.AddWithValue("@Status", InquiryStatus.POPendingForApproval);
                cmd.Parameters.AddWithValue("@CGST", objPOMod.ssmtbl_PurchaseOrderModel.CGST);
                cmd.Parameters.AddWithValue("@IGST", objPOMod.ssmtbl_PurchaseOrderModel.IGST);
                cmd.Parameters.AddWithValue("@SGST", objPOMod.ssmtbl_PurchaseOrderModel.SGST);
                cmd.Parameters.AddWithValue("@createdby", "Test");
                //cmd.Parameters.AddWithValue("@createdby", Session["UserId"].ToString());

                cmd.Parameters.AddWithValue("@POQty_Open", objPOMod.ssmtbl_PurchaseOrderModel.POQty_Open);
                cmd.Parameters.AddWithValue("@saq", objPOMod.ssmtbl_PurchaseOrderModel.sameasquotation);
                cmd.Parameters.AddWithValue("@createddate", StandardDateTime.GetDateTime());
                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Purchase Order Created Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
Ejemplo n.º 24
0
        // GET: Quotation
        public ActionResult NewQuotation(string id)
        {
            ssmtbl_QuotationModel   modelQuotation   = new ssmtbl_QuotationModel();
            ssmtbl_InquiryModel     modelInquiry     = new ssmtbl_InquiryModel();
            ssmtbl_FeasibilityModel modelFeasibility = new ssmtbl_FeasibilityModel();
            ssmtbl_QuotationModel   latestQuotation  = objQuotation.GetLetestQuotationID(Convert.ToInt32(id));

            try
            {
                if (id == "" || ModelState.IsValid == false)
                {
                    return(View(modelQuotation));
                }
                modelInquiry = objInqData.GetOneInquiry(Convert.ToInt32(id));

                if (latestQuotation.id == 0 || modelInquiry.Status == "Feasibility Done")
                {
                    if (modelInquiry != null)
                    {
                        modelQuotation.InquiryNo = modelInquiry.InquiryNo;
                        //modelQuotation.QuotationNo = "Q-" + modelInquiry.InquiryNo;
                        modelQuotation.QuotationNo     = "SSM_" + StandardDateTime.GetDateTime().ToString("yy") + StandardDateTime.GetDateTime().ToString("MM") + "_" + modelInquiry.InquiryNo;
                        modelQuotation.PartDescription = modelInquiry.PartName;
                        modelQuotation.PartNo          = modelInquiry.PartNo;
                        modelQuotation.CustomerName    = modelInquiry.customerName;
                        modelQuotation.FileStatus      = modelInquiry.Status;
                    }

                    modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(id));
                    if (modelFeasibility != null)
                    {
                        modelQuotation.CutWeight       = modelFeasibility.cutweight;
                        modelQuotation.NetWeight       = modelFeasibility.netweight;
                        modelQuotation.GrossWeight     = modelFeasibility.grossweight;
                        modelQuotation.MachainedWeight = modelFeasibility.materialweights.ToString();
                        modelQuotation.SectionId       = Convert.ToInt64(modelFeasibility.Section);             // Sharad
                        modelQuotation.Section         = objQuotation.getSectionNane(modelFeasibility.Section); // Sharad
                        ViewData["fistotal"]           = modelFeasibility.fisdiatotal;
                        string MaterialID      = modelFeasibility.FeasibilityMaterialGrade.ToString();
                        var    getMaterialGrad = objDrop.FeasibilityMaterialGrade().FirstOrDefault(m => m.Value == MaterialID);
                        if (getMaterialGrad != null)
                        {
                            modelQuotation.Material = getMaterialGrad.Text;
                        }
                        if (modelFeasibility.ssmtbl_Feasibility_MultiVendorModel != null)
                        {
                            ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel;
                        }
                        string HeattreatmentlID = modelFeasibility.FeasibilityHeattreatment.ToString();
                        var    getHeattreatment = objDrop.FeasibilityHeatTreatment().FirstOrDefault(m => m.Value == HeattreatmentlID);
                        if (getHeattreatment != null)
                        {
                            modelQuotation.HeatTreatmentID   = getHeattreatment.Value;
                            modelQuotation.HeatTreatmentText = getHeattreatment.Text;
                        }
                    }
                }
                else
                {
                    modelQuotation = latestQuotation;
                    modelQuotation.PerPieceRate = modelInquiry.Qty;
                    modelQuotation.CuttingRate  = objQuotation.GetOneCutingCalculation(Convert.ToInt32(modelQuotation.Section)).cuttingrateperpc;
                    // ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetSelectedQuotaionTermsAndCondition(modelQuotation.id);

                    modelFeasibility = objFesiData.GetOneFeasibility(Convert.ToInt32(latestQuotation.InquiryNo));
                    if (modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel != null)
                    {
                        ViewData["OperationsInvolved"] = modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel;
                        ViewData["NatureofWork"]       = modelFeasibility.FeasibilityNatureofWork;// Sharad
                    }
                    ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetLKP_QuotaionTermsAndCondition(modelInquiry.InquiryNo);
                    ViewData["Allversion"]   = objQuotation.GetAllversion(modelQuotation.InquiryNo);
                    modelQuotation.Material  = objQuotation.GetMaterialGradeByID(modelFeasibility.FeasibilityMaterialGrade); // Sharad
                    modelQuotation.SectionId = Convert.ToInt64(modelFeasibility.Section);                                    // Sharad
                    modelQuotation.Section   = objQuotation.getSectionNane(modelFeasibility.Section);                        // Sharad
                    string HeattreatmentlID = modelFeasibility.FeasibilityHeattreatment.ToString();
                    var    getHeattreatment = objDrop.FeasibilityHeatTreatment().FirstOrDefault(m => m.Value == HeattreatmentlID);
                    if (getHeattreatment != null)
                    {
                        modelQuotation.HeatTreatmentID   = getHeattreatment.Value;
                        modelQuotation.HeatTreatmentText = getHeattreatment.Text;
                    }
                    ViewData["fistotal"]     = modelFeasibility.fisdiatotal;
                    ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel;
                    return(View(modelQuotation));
                }

                modelQuotation.PerPieceRate = modelInquiry.Qty;
                modelFeasibility            = objFesiData.GetOneFeasibility(Convert.ToInt32(id));
                if (modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel != null)
                {
                    ViewData["OperationsInvolved"] = modelFeasibility.ssmtbl_Feasibility_OperationsInvolvedModel;
                    ViewData["NatureofWork"]       = modelFeasibility.FeasibilityNatureofWork;// Sharad
                }
                ViewData["QuotaionTermsAndCondition"] = GlobalFunction.GetLKP_QuotaionTermsAndCondition(modelInquiry.InquiryNo);
                ViewData["NatureofWork"] = modelFeasibility.FeasibilityNatureofWork;// Sharad
                ViewData["Allversion"]   = objQuotation.GetAllversion(modelQuotation.InquiryNo);
                ViewData["MultiVendors"] = modelFeasibility.ssmtbl_Feasibility_MultiVendorModel;
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(View(modelQuotation));
        }
Ejemplo n.º 25
0
        public Tuple <long, string> InsertFeasibility(ssmtbl_FeasibilityModel1 objFea)
        {
            string result = "Error Creating Feasibility";
            int    id     = 0;

            try
            {
                /////////////
                //var connection1 = gConnection.Connection();

                //string sqlstr1 = "InsertPreferedVendor";
                //SqlCommand cmd1 = new SqlCommand(sqlstr1, GlobalVariables.gConn);
                //cmd1.CommandType = System.Data.CommandType.StoredProcedure;

                //cmd1.Parameters.AddWithValue("@Name", objFea.MillTC.Trim());


                //cmd1.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
                //connection1.Open();
                //cmd1.ExecuteNonQuery();
                //string prefid = cmd1.Parameters["@id"].Value.ToString();
                //int preferedvendorid = Convert.ToInt32(prefid);
                //connection1.Close();
                ////////////
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "ssmsp_Insert_Feasibility";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@InquiryNo", objFea.InquiryNo);
                cmd.Parameters.AddWithValue("@FeasibilityConditionSupply", objFea.FeasibilityConditionSupply);
                cmd.Parameters.AddWithValue("@FeasibilityNatureofWork", objFea.FeasibilityNatureofWork);
                cmd.Parameters.AddWithValue("@FeasibilityTypeofJob", objFea.FeasibilityTypeofJob);
                cmd.Parameters.AddWithValue("@FeasibilityHammerRequired", objFea.FeasibilityHammerRequired);
                cmd.Parameters.AddWithValue("@FeasibilityToolingRequirement", objFea.FeasibilityToolingRequirement);
                cmd.Parameters.AddWithValue("@fisdiavalue", objFea.fisdiavalue);
                cmd.Parameters.AddWithValue("@fisdialength", objFea.fisdialength);
                cmd.Parameters.AddWithValue("@fisdiablocklength", objFea.fisdiablocklength);
                cmd.Parameters.AddWithValue("@fisdiablockwidth", objFea.fisdiablockwidth);
                cmd.Parameters.AddWithValue("@fisdiablockheight", objFea.fisdiablockheight);
                cmd.Parameters.AddWithValue("@MillTC", objFea.MillTC);
                cmd.Parameters.AddWithValue("@DieDescription", objFea.DieDescription);
                cmd.Parameters.AddWithValue("@grossweight", objFea.grossweight);
                cmd.Parameters.AddWithValue("@cutweight", objFea.cutweight);
                cmd.Parameters.AddWithValue("@Section", objFea.Section); // Sharad
                cmd.Parameters.AddWithValue("@cutlength", objFea.cutlength);
                cmd.Parameters.AddWithValue("@netweight", objFea.netweight);
                cmd.Parameters.AddWithValue("@materialweights", objFea.materialweights);
                cmd.Parameters.AddWithValue("@FeasibilityLubricantPreferred", objFea.FeasibilityLubricantPreferred);
                cmd.Parameters.AddWithValue("@FeasibilityMaterialGrade", objFea.FeasibilityMaterialGrade);
                cmd.Parameters.AddWithValue("@FeasibilityHeattreatment", objFea.FeasibilityHeattreatment);
                cmd.Parameters.AddWithValue("@Feasibilitystandardapplicable", objFea.Feasibilitystandardapplicable);
                cmd.Parameters.AddWithValue("@hardnessmin", objFea.hardnessmin);
                cmd.Parameters.AddWithValue("@hardnessmax", objFea.hardnessmax);
                cmd.Parameters.AddWithValue("@hardnessunits", objFea.hardnessunits);
                cmd.Parameters.AddWithValue("@micro", objFea.micro);
                cmd.Parameters.AddWithValue("@Status", InquiryStatus.FeasibilityDone);
                cmd.Parameters.AddWithValue("@FeasibilityStatutoryandregulatoryrequirement", objFea.FeasibilityStatutoryandregulatoryrequirement);
                cmd.Parameters.AddWithValue("@FeasibilityRemark", objFea.FeasibilityRemark);
                cmd.Parameters.AddWithValue("@feasibilitycreatedby", HttpContext.Current.Session["userid"].ToString());
                //cmd.Parameters.AddWithValue("@feasibilitycreatedby", Session["UserId"].ToString());
                cmd.Parameters.AddWithValue("@feasibilitycreateddate", StandardDateTime.GetDateTime());
                cmd.Parameters.AddWithValue("@fistotal", objFea.fisdiatotal);
                cmd.Parameters.AddWithValue("@PreferedVendorID", 0);

                cmd.Parameters.Add("@Feasid", SqlDbType.Int);
                cmd.Parameters["@Feasid"].Direction = ParameterDirection.Output;


                //DataTable dataTable1 = new DataTable("SampleDataType");
                //dataTable1.Columns.Add("Operations_Involved", typeof(string));
                //foreach (var data in objFea.ssmtbl_Feasibility_OperationsInvolvedModel)
                //{
                //    if (data.Operations_Involved_Select == true)
                //    {
                //        dataTable1.Rows.Add(data.Operations_Involved);
                //    }
                //}
                //var pList = new SqlParameter("@ssmtbl_Feasibility_OperationsInvolved_", SqlDbType.Structured);
                //pList.TypeName = "dbo.ssmtbl_Feasibility_OperationsInvolved";
                //pList.Value = dataTable1;
                //cmd.Parameters.Add(pList);


                //DataTable dataTable2 = new DataTable("SampleDataType1");
                //dataTable2.Columns.Add("Raw_Material_Test", typeof(string));

                //foreach (var data in objFea.ssmtbl_Feasibility_RawMaterialTestModel)
                //{
                //    if (data.Raw_Material_Test_Select == true)
                //    {
                //        dataTable2.Rows.Add(data.Raw_Material_Test);
                //    }
                //}
                //var pList1 = new SqlParameter("@ssmtbl_Feasibility_RawMaterialTest_", SqlDbType.Structured);
                //pList1.TypeName = "dbo.ssmtbl_Feasibility_RawMaterialTest";
                //pList1.Value = dataTable2;
                //cmd.Parameters.Add(pList1);



                SqlDataReader sdr = cmd.ExecuteReader();
                while (sdr.Read())
                {
                    id = Convert.ToInt32(sdr[0].ToString());
                }
                connection.Close();

                result = "Feasibility Created Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(new Tuple <long, string>(id, result));
        }
Ejemplo n.º 26
0
        public string CreateQVersion(ssmtbl_QuotationModel model, int QuotationId)
        {
            string result = "Error Updating Quotataion";

            try
            {
                var connection = gConnection.Connection();
                connection.Open();
                string     sqlstr = "uspInsertQuotationVersion";
                SqlCommand cmd    = new SqlCommand(sqlstr, GlobalVariables.gConn);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@id", QuotationId);
                cmd.Parameters.AddWithValue("@InquiryNo", model.InquiryNo);
                cmd.Parameters.AddWithValue("@QuotationNo", model.QuotationNo);
                cmd.Parameters.AddWithValue("@CustomerName", model.CustomerName.Trim());

                cmd.Parameters.AddWithValue("@PartDescription", model.PartDescription);
                cmd.Parameters.AddWithValue("@PartNo", model.PartNo);
                cmd.Parameters.AddWithValue("@HeatTreatment", model.HeatTreatmentID);

                cmd.Parameters.AddWithValue("@Material", model.Material);
                // cmd.Parameters.AddWithValue("@Section", model.Section);
                cmd.Parameters.AddWithValue("@Section", model.SectionId); // Sharad
                cmd.Parameters.AddWithValue("@MachainedWeight", model.MachainedWeight);

                cmd.Parameters.AddWithValue("@GrossWeight", model.GrossWeight);
                cmd.Parameters.AddWithValue("@CutWeight", model.CutWeight);
                cmd.Parameters.AddWithValue("@NetWeight", model.NetWeight);

                cmd.Parameters.AddWithValue("@ForgingCostBased", model.ForgingCostBased);
                cmd.Parameters.AddWithValue("@MPICostBasedOn", model.MPICostBasedOn);
                cmd.Parameters.AddWithValue("@SteelCost", model.SteelCost);

                cmd.Parameters.AddWithValue("@Transportation", model.Transportation);
                cmd.Parameters.AddWithValue("@Total", model.Total);
                cmd.Parameters.AddWithValue("@TotalRowMaterialCost", model.TotalRowMaterialCost);

                cmd.Parameters.AddWithValue("@CuttingSquare1", model.CuttingSquare1);
                cmd.Parameters.AddWithValue("@CuttingSquare2", model.CuttingSquare2);

                cmd.Parameters.AddWithValue("@Forging1", model.Forging1);
                cmd.Parameters.AddWithValue("@Forging2", model.Forging2);

                cmd.Parameters.AddWithValue("@HeatTreatment1", model.HeatTreatment1);
                cmd.Parameters.AddWithValue("@HeatTreatment2", model.HeatTreatment2);

                cmd.Parameters.AddWithValue("@ShotBlasting1", model.ShotBlasting1);
                cmd.Parameters.AddWithValue("@ShotBlasting2", model.ShotBlasting2);

                cmd.Parameters.AddWithValue("@MPI1", model.MPI1);
                cmd.Parameters.AddWithValue("@MPI2", model.MPI2);

                cmd.Parameters.AddWithValue("@Grinding1", model.Grinding1);
                cmd.Parameters.AddWithValue("@Grinding2", model.Grinding2);

                cmd.Parameters.AddWithValue("@ColdCoining1", model.ColdCoining1);
                cmd.Parameters.AddWithValue("@ColdCoining2", model.ColdCoining2);

                cmd.Parameters.AddWithValue("@Machining1", model.Machining1);
                cmd.Parameters.AddWithValue("@Machining2", model.Machining2);

                cmd.Parameters.AddWithValue("@DieMaintenance1", model.DieMaintenance1);
                cmd.Parameters.AddWithValue("@DieMaintenance2", model.DieMaintenance2);
                cmd.Parameters.AddWithValue("@Status", InquiryStatus.QuotationPendingForApproval);
                cmd.Parameters.AddWithValue("@FileStatus", InquiryStatus.QuotationPendingForApproval);

                cmd.Parameters.AddWithValue("@TotalConverstionCost", model.TotalConverstionCost);
                cmd.Parameters.AddWithValue("@TotalComponentCost", model.TotalComponentCost);
                cmd.Parameters.AddWithValue("@InitialDieCost", model.InitialDieCost);
                cmd.Parameters.AddWithValue("@UserComment", model.UserComment);

                //var pList = new SqlParameter("@ssmUT_TermsNCondtion_", SqlDbType.Structured);
                //pList.TypeName = "dbo.ssmUT_TermsNCondtion";
                //pList.Value = dt;
                //cmd.Parameters.Add(pList);

                cmd.Parameters.AddWithValue("@Createdby", "Test");
                cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());

                //cmd.Parameters.AddWithValue("@Iccoverhead", model.iccoverhadrm);
                //cmd.Parameters.AddWithValue("@Iccoverheadtotal", model.totaliccoverhadrm);
                //cmd.Parameters.AddWithValue("@Profitconversion", model.profitonconversion);
                //cmd.Parameters.AddWithValue("@TotalProfitconversion", model.totalprofitonconversion);
                //cmd.Parameters.AddWithValue("@Rejection", model.rejection);
                //cmd.Parameters.AddWithValue("@TotalRejection", model.totalrejection);
                //cmd.Parameters.AddWithValue("@Packing", model.packingtransport);
                //cmd.Parameters.AddWithValue("@TotalPacking", model.totalpackingtransport);
                //cmd.Parameters.AddWithValue("@TotallyCost", model.totallycost);
                if (model.iccoverhadrm != " ")
                {
                    cmd.Parameters.AddWithValue("@Iccoverhead", model.iccoverhadrm);
                }
                if (model.totaliccoverhadrm != " ")
                {
                    cmd.Parameters.AddWithValue("@Iccoverheadtotal", model.totaliccoverhadrm);
                }
                if (model.profitonconversion != " ")
                {
                    cmd.Parameters.AddWithValue("@Profitconversion", model.profitonconversion);
                }
                if (model.totalprofitonconversion != " ")
                {
                    cmd.Parameters.AddWithValue("@TotalProfitconversion", model.totalprofitonconversion);
                }
                if (model.rejection != " ")
                {
                    cmd.Parameters.AddWithValue("@Rejection", model.rejection);
                }
                if (model.totalrejection != " ")
                {
                    cmd.Parameters.AddWithValue("@TotalRejection", model.totalrejection);
                }
                if (model.packingtransport != " ")
                {
                    cmd.Parameters.AddWithValue("@Packing", model.packingtransport);
                }
                if (model.totalpackingtransport != " ")
                {
                    cmd.Parameters.AddWithValue("@TotalPacking", model.totalpackingtransport);
                }
                if (model.totallycost != " ")
                {
                    cmd.Parameters.AddWithValue("@TotallyCost", model.totallycost);
                }

                cmd.ExecuteNonQuery();
                connection.Close();
                result = "Quotation version create Successfully!";
            }
            catch (Exception ex)
            {
                Global.ErrorHandlerClass.LogError(ex);
            }
            return(result);
        }
        public string UpdateCustomerDetails(ACRF_CustomerDetailsModel objModel)
        {
            string result = "Error on Updating Customer Details!";

            try
            {
                objModel = NullToBlank(objModel);
                result   = CheckIfCustomerDetailsExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_CustomerDetails set CustomerName=@CustomerName,Address=@Address,ContactName=@ContactName,"
                                 + " Mobile=@Mobile,Email=@Email,FAX=@FAX,SkypeId=@SkypeId,Website=@Website,MiscInfo=@MiscInfo "
                                 + " ,CountryId=@CountryId,PostalCode=@PostalCode,UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn "
                                 + " where Id=@Id ";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);
                        cmd.Parameters.AddWithValue("@CustomerName", objModel.CustomerName);
                        cmd.Parameters.AddWithValue("@Address", objModel.Address);
                        cmd.Parameters.AddWithValue("@ContactName", objModel.ContactName);
                        cmd.Parameters.AddWithValue("@Mobile", objModel.Mobile);
                        cmd.Parameters.AddWithValue("@Email", objModel.Email);
                        cmd.Parameters.AddWithValue("@FAX", objModel.FAX);
                        cmd.Parameters.AddWithValue("@SkypeId", objModel.SkypeId);
                        cmd.Parameters.AddWithValue("@Website", objModel.Website);
                        cmd.Parameters.AddWithValue("@MiscInfo", objModel.MiscInfo);
                        cmd.Parameters.AddWithValue("@CountryId", objModel.CountryId);
                        cmd.Parameters.AddWithValue("@PostalCode", objModel.PostalCode);
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.UpdatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Customer Details Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 28
0
        public string UpdateDestinationMaster(ACRF_DestinationMasterModel objModel)
        {
            string result = "Error on Updating Destination Master!";

            try
            {
                objModel = NullToBlank(objModel);
                result   = CheckIfDestinationMasterExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_DestinationMaster set CityCode=@CityCode,CityName=@CityName,CountryCode=@CountryCode,CountryName=@CountryName,TimeDifference=@TimeDifference, "
                                 + " CustomAirport=@CustomAirport,AirportName=@AirportName,ISDCode=@ISDCode,Currency=@Currency,State=@State,IATAArea=@IATAArea,UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn "
                                 + " where Id=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@CityCode", objModel.CityCode);
                        cmd.Parameters.AddWithValue("@CityName", objModel.CityName);
                        cmd.Parameters.AddWithValue("@CountryCode", objModel.CountryCode);
                        cmd.Parameters.AddWithValue("@CountryName", objModel.CountryName);
                        cmd.Parameters.AddWithValue("@TimeDifference", objModel.TimeDifference);
                        cmd.Parameters.AddWithValue("@CustomAirport", objModel.CustomAirport);
                        cmd.Parameters.AddWithValue("@AirportName", objModel.AirportName);
                        cmd.Parameters.AddWithValue("@ISDCode", objModel.ISDCode);
                        cmd.Parameters.AddWithValue("@Currency", objModel.Currency);
                        cmd.Parameters.AddWithValue("@State", objModel.State);
                        cmd.Parameters.AddWithValue("@IATAArea", objModel.IATAArea);
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.CreatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.Parameters.AddWithValue("@Id", objModel.Id);
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Destination Master Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 29
0
        public string UpdateCargoRateSettings(ACRF_CargoRateSettingsModel objModel)
        {
            string result = "Error on Updating Airlines!";

            try
            {
                objModel = NullToBlank(objModel);
                result   = CheckIfCargoRateSettingsExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "update ACRF_CargoRateSettings set Rate1=@Rate1,Rate2=@Rate2,Rate3=@Rate3,UpdatedBy=@UpdatedBy,UpdatedOn=@UpdatedOn,IsRate1=@IsRate1,IsRate2=@IsRate2,IsRate3=@IsRate3,DisplayRate1=@DisplayRate1,DisplayRate2=@DisplayRate2,DisplayRate3=@DisplayRate3"
                                 + " where VendorId=@Id";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Rate1", objModel.Rate1);
                        cmd.Parameters.AddWithValue("@Rate2", objModel.Rate2);
                        cmd.Parameters.AddWithValue("@Rate3", objModel.Rate3);
                        cmd.Parameters.AddWithValue("@Id", objModel.VendorId);
                        cmd.Parameters.AddWithValue("@UpdatedBy", objModel.CreatedBy);
                        cmd.Parameters.AddWithValue("@UpdatedOn", StandardDateTime.GetDateTime());
                        cmd.Parameters.AddWithValue("@IsRate1", objModel.IsRate1);
                        cmd.Parameters.AddWithValue("@IsRate2", objModel.IsRate2);
                        cmd.Parameters.AddWithValue("@IsRate3", objModel.IsRate3);
                        cmd.Parameters.AddWithValue("@DisplayRate1", objModel.DisplayRate1);
                        cmd.Parameters.AddWithValue("@DisplayRate2", objModel.DisplayRate2);
                        cmd.Parameters.AddWithValue("@DisplayRate3", objModel.DisplayRate3);
                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "Cargoratesettings Updated Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }
Ejemplo n.º 30
0
        public string CreateCargoRateSettings(ACRF_CargoRateSettingsModel objModel)
        {
            string result = "Error on Saving Cargo Rates!";

            try
            {
                objModel = NullToBlank(objModel);
                result   = CheckIfCargoRateSettingsExists(objModel);
                if (result == "")
                {
                    var connection = gConnection.Connection();
                    connection.Open();
                    SqlCommand     cmd = connection.CreateCommand();
                    SqlTransaction transaction;
                    transaction     = connection.BeginTransaction();
                    cmd.Transaction = transaction;
                    cmd.Connection  = connection;
                    try
                    {
                        string sqlstr = "";
                        sqlstr = "insert into ACRF_CargoRateSettings(Rate1,Rate2,Rate3,CreatedBy,CreatedOn,IsRate1,IsRate2,IsRate3,VendorId,DisplayRate1,"
                                 + " DisplayRate2,DisplayRate3) values  (@Rate1,@Rate2,@Rate3,@CreatedBy,@CreatedOn,@IsRate1,@IsRate2,@IsRate3,@VendorId,@DisplayRate1,"
                                 + " @DisplayRate2,@DisplayRate3)";
                        cmd.CommandText = sqlstr;
                        cmd.Parameters.Clear();
                        cmd.Parameters.AddWithValue("@Rate1", objModel.Rate1);
                        cmd.Parameters.AddWithValue("@Rate2", objModel.Rate2);
                        cmd.Parameters.AddWithValue("@Rate3", objModel.Rate3);
                        cmd.Parameters.AddWithValue("@CreatedBy", objModel.CreatedBy);
                        cmd.Parameters.AddWithValue("@CreatedOn", StandardDateTime.GetDateTime());
                        cmd.Parameters.AddWithValue("@IsRate1", objModel.IsRate1);
                        cmd.Parameters.AddWithValue("@IsRate2", objModel.IsRate2);
                        cmd.Parameters.AddWithValue("@IsRate3", objModel.IsRate3);
                        cmd.Parameters.AddWithValue("@VendorId", objModel.VendorId);
                        cmd.Parameters.AddWithValue("@DisplayRate1", objModel.DisplayRate1);
                        cmd.Parameters.AddWithValue("@DisplayRate2", objModel.DisplayRate2);
                        cmd.Parameters.AddWithValue("@DisplayRate3", objModel.DisplayRate3);

                        cmd.ExecuteNonQuery();


                        transaction.Commit();
                        connection.Close();
                        result = "CargoRateSettings Added Successfully!";
                    }
                    catch (Exception ex)
                    {
                        transaction.Rollback();
                        connection.Close();
                        Global.ErrorHandlerClass.LogError(ex);
                        result = ex.Message;
                    }
                }
                else
                {
                    return(result);
                }
            }
            catch (Exception ex)
            {
                ErrorHandlerClass.LogError(ex);
            }

            return(result);
        }