protected void VIN_TextChanged(object sender, EventArgs e) { if (ORSVTypeID.SelectedValue == "1") { //first we need to get our jobject, but no point if the vin validation fails DetailError.Text = Util.FormValidation("", VIN, Util.ValidationType.VIN, true); if (DetailError.Text.Length == 0) { //first, reset color VIN.BackColor = Util.DefaultColor; //now reset error message DetailError.Text = ""; string VINapiReturn = Util.VinValidator(VIN.Text); //new get the jObject try { JObject o = JObject.Parse(VINapiReturn); if (!(o == null)) { //alright, now we need to breakout the [node?], remember case sensitive JArray styleHolder = (JArray)o["styleHolder"]; VehicleYear.Text = (string)styleHolder.First["year"]; VehicleModel.Text = (string)styleHolder.First["modelName"]; //add the Make to the dropdown if it's not there DropDownList ddlMake = VehicleMakeID; string sMake = (string)styleHolder.First["makeName"]; string sMakeID = ""; //not using "FindByText" because it is case-sensitive bool isMissing = true; foreach (ListItem item in ddlMake.Items) { if (sMake.ToLower() == item.Text.ToLower()) { isMissing = false; sMakeID = item.Value; break; } } //add the Make if it's missing if (isMissing) { //create the new lookup table record sMakeID = usp_zlk_Make_Ins(sMake); //refresh the Make dropdown Util.LoadList(ddlMake, "usp_MakeDDL_Sel", "MakeID", "MakeName"); } //finally, select the make from the dropdown ddlMake.SelectedValue = sMakeID; } } catch (Exception ex) { DetailError.Text = VINapiReturn; } } } else if (ORSVTypeID.SelectedValue == "2") { DetailError.Text = Util.FormValidation("HIN", VIN, Util.ValidationType.Length, true, 12, 12); } CustomerID.Focus(); }
//////////////////////// Constructors ////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// Return a user friendly display string for this Customer instance. /// </summary> /// <returns></returns> public string GetDisplayText() { return($"First Name: {FirstName} Last Name: {LastName} Date Of Birth: {DateOfBirth.ToString("MMM dd yyyy")} CustomerID: {CustomerID.ToString()}"); }
public void editCustomer(string id) { EditCustomerLink.Click(); CustomerID.SendKeys(id); Submit.Click(); }
public void checkReset(string id) { EditCustomerLink.Click(); CustomerID.SendKeys(id); Reset.Click(); }
public void InsertTenderDtls() { try { SqlParameter spDocumentID = new SqlParameter(); spDocumentID.ParameterName = "@DocumentID"; spDocumentID.SqlDbType = System.Data.SqlDbType.NVarChar; spDocumentID.Value = DocumentID; SqlParameter spLocationID = new SqlParameter(); spLocationID.ParameterName = "@LocationID"; spLocationID.SqlDbType = System.Data.SqlDbType.NVarChar; spLocationID.Value = LocationID; SqlParameter spTerminalID = new SqlParameter(); spTerminalID.ParameterName = "@TerminalID"; spTerminalID.SqlDbType = System.Data.SqlDbType.NVarChar; spTerminalID.Value = TerminalID; SqlParameter spCompanyID = new SqlParameter(); spCompanyID.ParameterName = "@CompanyID"; spCompanyID.SqlDbType = System.Data.SqlDbType.NVarChar; spCompanyID.Value = CompanyID; SqlParameter spStorageID = new SqlParameter(); spStorageID.ParameterName = "@StorageID"; spStorageID.SqlDbType = System.Data.SqlDbType.NVarChar; spStorageID.Value = StorageID; SqlParameter spCustomerID = new SqlParameter(); spCustomerID.ParameterName = "@CustomerID"; spCustomerID.SqlDbType = System.Data.SqlDbType.NVarChar; if (!CustomerID.Equals(string.Empty)) { spCustomerID.Value = CustomerID; } else { spCustomerID.Value = DBNull.Value; } SqlParameter spTenderID = new SqlParameter(); spTenderID.ParameterName = "@TenderID"; spTenderID.SqlDbType = System.Data.SqlDbType.NVarChar; spTenderID.Value = TenderID; SqlParameter spPostingType = new SqlParameter(); spPostingType.ParameterName = "@PostingType"; spPostingType.SqlDbType = System.Data.SqlDbType.NVarChar; spPostingType.Value = PostingType; SqlParameter spCounter = new SqlParameter(); spCounter.ParameterName = "@Counter"; spCounter.SqlDbType = System.Data.SqlDbType.Int; spCounter.Value = Counter; SqlParameter spDocumentDate = new SqlParameter(); spDocumentDate.ParameterName = "@DocumentDate"; spDocumentDate.SqlDbType = System.Data.SqlDbType.DateTime; spDocumentDate.Value = DocumentDate; SqlParameter spPostingDate = new SqlParameter(); spPostingDate.ParameterName = "@PostingDate"; spPostingDate.SqlDbType = System.Data.SqlDbType.Date; spPostingDate.Value = PostingDate; SqlParameter spAmount = new SqlParameter(); spAmount.ParameterName = "@Amount"; spAmount.SqlDbType = System.Data.SqlDbType.Decimal; spAmount.Value = Amount; SqlParameter spChangeAmount = new SqlParameter(); spChangeAmount.ParameterName = "@ChangeAmount"; spChangeAmount.SqlDbType = System.Data.SqlDbType.Decimal; spChangeAmount.Value = ChangeAmount; SqlParameter spPaidAmount = new SqlParameter(); spPaidAmount.ParameterName = "@PaidAmount"; spPaidAmount.SqlDbType = System.Data.SqlDbType.Decimal; spPaidAmount.Value = PaidAmount; SqlParameter spTransCode = new SqlParameter(); spTransCode.ParameterName = "@TransCode"; spTransCode.SqlDbType = System.Data.SqlDbType.NVarChar; spTransCode.Value = TransCode; string TenderDtls = "INSERT INTO TBL_TENDER_DETAIL(DOCUMENTID,LOCATIONID,TERMINALID,COUNTER,COMPANYID,STORAGEID,DOCUMENTDATE,POSTINGTYPE,POSTINGDATE,CUSTOMERID,TENDERID,AMOUNT,PAIDAMOUNT,CHANGEAMOUNT,TRANSCODE) VALUES(@DOCUMENTID,@LOCATIONID,@TERMINALID,@COUNTER,@COMPANYID," + " @STORAGEID,@DOCUMENTDATE,@POSTINGTYPE,@POSTINGDATE,@CUSTOMERID,@TENDERID,@AMOUNT,@PAIDAMOUNT,@CHANGEAMOUNT,@TRANSCODE)"; datacon.ConString = DataCon; datacon.CmdType = CommandType.Text; datacon.CmdString = TenderDtls; datacon.InsertRecord(spDocumentID, spLocationID, spTerminalID, spCompanyID, spStorageID, spCustomerID, spTenderID, spPostingType, spCounter, spDocumentDate, spPostingDate, spAmount, spChangeAmount, spPaidAmount, spTransCode); UpdateReadTenderdtls(); } catch (Exception ex) { string _Ex = ex.Message; string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Tender_Detail'. Cannot insert duplicate key in object 'dbo.tbl_Tender_Detail'.\r\nThe statement has been terminated."; if (_Error.Equals(_Ex)) { UpdateReadTenderdtls(); } else { throw; } } }
//////////////////////// Constructors ////////////////////////////// //////////////////////////////////////////////////////////////////// /// <summary> /// Return a user friendly display string for this Registration instance. /// </summary> /// <returns></returns> public string GetDisplayText() { return($"Customer: {CustomerID.ToString()} registered book: {BookISBN}"); }
public void InsertInvoiceDtls() { try { SqlParameter spDoc = new SqlParameter(); spDoc.ParameterName = "@DocumentID"; spDoc.SqlDbType = System.Data.SqlDbType.NVarChar; spDoc.Value = DocumentID; SqlParameter spLocationID = new SqlParameter(); spLocationID.ParameterName = "@LocationID"; spLocationID.SqlDbType = System.Data.SqlDbType.NVarChar; spLocationID.Value = LocationID; SqlParameter spStorageID = new SqlParameter(); spStorageID.ParameterName = "@StorageID"; spStorageID.SqlDbType = System.Data.SqlDbType.NVarChar; spStorageID.Value = StorageID; SqlParameter spTerminalID = new SqlParameter(); spTerminalID.ParameterName = "@TerminalID"; spTerminalID.SqlDbType = System.Data.SqlDbType.NVarChar; spTerminalID.Value = TerminalID; SqlParameter spCounter = new SqlParameter(); spCounter.ParameterName = "@Counter"; spCounter.SqlDbType = System.Data.SqlDbType.Int; spCounter.Value = Counter; SqlParameter spSalesOrder = new SqlParameter(); spSalesOrder.ParameterName = "@SalesOrder"; spSalesOrder.SqlDbType = System.Data.SqlDbType.NVarChar; spSalesOrder.Value = SalesOrder; SqlParameter spCompanyID = new SqlParameter(); spCompanyID.ParameterName = "@CompanyID"; spCompanyID.SqlDbType = System.Data.SqlDbType.NVarChar; spCompanyID.Value = CompanyID; SqlParameter spDoumentDate = new SqlParameter(); spDoumentDate.ParameterName = "@DocumentDate"; spDoumentDate.SqlDbType = System.Data.SqlDbType.DateTime; spDoumentDate.Value = DocumentDate; SqlParameter spPostingType = new SqlParameter(); spPostingType.ParameterName = "@PostingType"; spPostingType.SqlDbType = System.Data.SqlDbType.NVarChar; spPostingType.Value = PostingType; SqlParameter spCustomerID = new SqlParameter(); spCustomerID.ParameterName = "@CustomerID"; spCustomerID.SqlDbType = System.Data.SqlDbType.NVarChar; if (!CustomerID.Equals(string.Empty)) { spCustomerID.Value = CustomerID; } else { spCustomerID.Value = DBNull.Value; } SqlParameter spCategoryID = new SqlParameter(); spCategoryID.ParameterName = "@CategoryID"; spCategoryID.SqlDbType = System.Data.SqlDbType.NVarChar; spCategoryID.Value = CategoryID; SqlParameter spMaterialID = new SqlParameter(); spMaterialID.ParameterName = "@MaterialID"; spMaterialID.SqlDbType = System.Data.SqlDbType.NVarChar; spMaterialID.Value = MaterialID; SqlParameter spUOM = new SqlParameter(); spUOM.ParameterName = "@UOM"; spUOM.SqlDbType = System.Data.SqlDbType.NVarChar; spUOM.Value = UOM; SqlParameter spTranQty = new SqlParameter(); spTranQty.ParameterName = "@TranQty"; spTranQty.SqlDbType = System.Data.SqlDbType.Decimal; spTranQty.Value = TranQty; SqlParameter spBaseQty = new SqlParameter(); spBaseQty.ParameterName = "@BaseQty"; spBaseQty.SqlDbType = System.Data.SqlDbType.Decimal; spBaseQty.Value = BaseQty; SqlParameter spCreditQty = new SqlParameter(); spCreditQty.ParameterName = "@CreditQty"; spCreditQty.SqlDbType = System.Data.SqlDbType.Decimal; spCreditQty.Value = CreditQty; SqlParameter spCost = new SqlParameter(); spCost.ParameterName = "@Cost"; spCost.SqlDbType = System.Data.SqlDbType.Decimal; spCost.Value = Cost; SqlParameter spPrice = new SqlParameter(); spPrice.ParameterName = "@Price"; spPrice.SqlDbType = System.Data.SqlDbType.Decimal; spPrice.Value = Price; SqlParameter spDiscountRate = new SqlParameter(); spDiscountRate.ParameterName = "@DiscountRate"; spDiscountRate.SqlDbType = System.Data.SqlDbType.Decimal; spDiscountRate.Value = DiscountRate; SqlParameter spAmount = new SqlParameter(); spAmount.ParameterName = "@Amount"; spAmount.SqlDbType = System.Data.SqlDbType.Decimal; spAmount.Value = Amount; SqlParameter spCreditAmount = new SqlParameter(); spCreditAmount.ParameterName = "@CreditAmount"; spCreditAmount.SqlDbType = System.Data.SqlDbType.Decimal; spCreditAmount.Value = CreditAmount; SqlParameter spUserID = new SqlParameter(); spUserID.ParameterName = "@UserID"; spUserID.SqlDbType = System.Data.SqlDbType.NVarChar; spUserID.Value = UserID; SqlParameter spPostKey = new SqlParameter(); spPostKey.ParameterName = "@PostKey"; spPostKey.SqlDbType = System.Data.SqlDbType.Int; spPostKey.Value = PostKey; SqlParameter spAddDate = new SqlParameter(); spAddDate.ParameterName = "@AddDate"; spAddDate.SqlDbType = System.Data.SqlDbType.DateTime; spAddDate.Value = AddDate; SqlParameter spUpdDate = new SqlParameter(); spUpdDate.ParameterName = "@UpdDate"; spUpdDate.SqlDbType = System.Data.SqlDbType.DateTime; spUpdDate.Value = UpdDate; SqlParameter spPostingDate = new SqlParameter(); spPostingDate.ParameterName = "@PostingDate"; spPostingDate.SqlDbType = System.Data.SqlDbType.DateTime; spPostingDate.Value = DocumentDate; SqlParameter spOrderNo = new SqlParameter(); spOrderNo.ParameterName = "@OrderNo"; spOrderNo.SqlDbType = System.Data.SqlDbType.NVarChar; spOrderNo.Value = OrderNo; SqlParameter spSalesComm = new SqlParameter(); spSalesComm.ParameterName = "@SalesComm"; spSalesComm.SqlDbType = System.Data.SqlDbType.Decimal; spSalesComm.Value = Sales_Comm; SqlParameter spProducComm = new SqlParameter(); spProducComm.ParameterName = "@ProducComm"; spProducComm.SqlDbType = System.Data.SqlDbType.Decimal; spProducComm.Value = Produc_Comm; SqlParameter spTax = new SqlParameter(); spTax.ParameterName = "@Tax"; spTax.SqlDbType = System.Data.SqlDbType.Decimal; spTax.Value = TaxAmount; SqlParameter spCostAmount = new SqlParameter(); spCostAmount.ParameterName = "@CostAmount"; spCostAmount.SqlDbType = System.Data.SqlDbType.Decimal; spCostAmount.Value = CostAmount; SqlParameter spOrderUserName = new SqlParameter(); spOrderUserName.ParameterName = "@OrderUserName"; spOrderUserName.SqlDbType = System.Data.SqlDbType.NVarChar; spOrderUserName.Value = OrderUsername; SqlParameter spOrderTransQty = new SqlParameter(); spOrderTransQty.ParameterName = "@OrderTransQty"; spOrderTransQty.SqlDbType = System.Data.SqlDbType.NVarChar; spOrderTransQty.Value = OrderTransQty; SqlParameter spOrderBaseQty = new SqlParameter(); spOrderBaseQty.ParameterName = "@OrderBaseQty"; spOrderBaseQty.SqlDbType = System.Data.SqlDbType.NVarChar; spOrderBaseQty.Value = OrderBaseQty; string InvoiceDtls = "INSERT INTO TBL_SALES_DETAIL(DOCUMENTID,COMPANYID,LOCATIONID,STORAGEID,TERMINALID,DOCUMENTDATE,POSTINGTYPE,CUSTOMERID,COUNTER,CATEGORYID,MATERIALID,POSTINGDATE,UOM," + " TRANQTY,BASEQTY,CREDITQTY,COST,PRICE,DISCOUNTRATE,AMOUNT,CREDITAMOUNT,USERID,POSTKEY,ADDDATE,UPDDATE,RtnQty,OrderNo,Sales_CommAmount,Produc_CommAmount,TaxAmount,CostAmount,OrderUserName,OrderTransQty,OrderBaseQty)" + " VALUES(@DOCUMENTID,@COMPANYID,@LOCATIONID,@STORAGEID,@TERMINALID,@DOCUMENTDATE," + " @POSTINGTYPE,@CUSTOMERID,@COUNTER,@CATEGORYID,@MATERIALID,@POSTINGDATE,@UOM," + " @TRANQTY,@BASEQTY,@CREDITQTY,@COST,@PRICE,@DISCOUNTRATE,@AMOUNT,@CREDITAMOUNT,@USERID,@POSTKEY,@ADDDATE," + " @UPDDATE,0,@OrderNo,@SalesComm,@ProducComm,@Tax,@CostAmount,@OrderUserName,@OrderTransQty,@OrderBaseQty)"; dcon.ConString = Datacon; dcon.CmdType = CommandType.Text; dcon.CmdString = InvoiceDtls; dcon.InsertRecord(spDoc, spCompanyID, spLocationID, spStorageID, spTerminalID, spDoumentDate, spPostingType, spCustomerID, spCounter, spCategoryID, spMaterialID, spPostingDate, spUOM, spTranQty, spBaseQty, spCreditQty, spCost, spPrice, spDiscountRate, spAmount, spCreditAmount, spUserID, spPostKey, spAddDate, spUpdDate, spOrderNo, spSalesComm, spProducComm, spTax, spCostAmount, spOrderUserName, spOrderTransQty, spOrderBaseQty); UpdateReadSalesdtls(); } catch (Exception ex) { string _Ex = ex.Message; string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Sales_Detail'. Cannot insert duplicate key in object 'dbo.tbl_Sales_Detail'.\r\nThe statement has been terminated."; if (_Error.Equals(_Ex)) { UpdateReadSalesdtls(); } else { throw; } } }
Int32 DisplayPostcode(string PostcodeFilter) { Int32 CustomerID; string Customerpostcode; string Customerfirstname; //create an instance of the Shoes Collection clsCustomerCollection CustomerPostcode = new clsCustomerCollection(); //invoke the shoe brand filter CustomerPostcode.ReportByPostcode(PostcodeFilter); //var to store the count of records Int32 RecordCount; //var to store the index for the loop Int32 Index = 0; //get the count of records RecordCount = CustomerPostcode.Count; //clear the list box lstCustomers.Items.Clear(); //while there are records to process while (Index < RecordCount) { //get the primary key CustomerID = CustomerPostcode.CustomerList[Index].CustomerID; //get the shoe name Customerpostcode = CustomerPostcode.CustomerList[Index].Customerpostcode; Customerfirstname = CustomerPostcode.CustomerList[Index].Customerfirstname; //create a new entry for the list box ListItem NewEntry = new ListItem(Customerpostcode + " " + Customerfirstname, CustomerID.ToString()); //add the shoes to the list lstCustomers.Items.Add(NewEntry); //move the index to the next record Index++; } return(RecordCount); }
public void ToRow(DataTable tbl) { tbl.Rows.Add( CustomerID.ToString("G0", gb), CashRequestID.ToString("G0", gb), CreationDate.ToString("d/MMM/yyyy H:mm:ss", gb), ManualDecisionTime.ToString("d/MMM/yyyy H:mm:ss", gb), ApprovedAmount.ToString("C0", gb), InterestRate.ToString("P2", gb), RepaymentPeriod.ToString("G0", gb), ManualSetupFeePercent.ToString("P2", gb), BrokerSetupFeePercent.ToString("P2", gb), SpreadSetupFee ? "spread" : "deduced", string.Empty, string.Empty, string.Empty, "total" ); var first = GetFirstTrail(); var main = GetMainTrail(); var last = GetLastTrail(); if (first.IsEmpty && main.IsEmpty && last.IsEmpty) { return; } tbl.Rows.Add( string.Empty, first.GetTrailID("First"), first.DecisionTimeStr, first.StatusStr, first.TagStr, main.GetTrailID("Main"), main.DecisionTimeStr, main.StatusStr, main.TagStr, last.GetTrailID("Last"), last.DecisionTimeStr, last.StatusStr, last.TagStr, string.Empty ); var firstTraces = first.Traces; var mainTraces = main.Traces; var lastTraces = last.Traces; int maxLen = Math.Max(firstTraces.Length, Math.Max(mainTraces.Length, lastTraces.Length)); for (int i = 0; i < maxLen; i++) { NotAutoApprovedTrace f = i < firstTraces.Length ? firstTraces[i] : new NotAutoApprovedTrace(); NotAutoApprovedTrace m = i < mainTraces.Length ? mainTraces[i] : new NotAutoApprovedTrace(); NotAutoApprovedTrace l = i < lastTraces.Length ? lastTraces[i] : new NotAutoApprovedTrace(); tbl.Rows.Add( string.Empty, string.Empty, f.TraceNameStr, f.CommentStr, string.Empty, string.Empty, m.TraceNameStr, m.Comment, string.Empty, string.Empty, l.TraceNameStr, l.CommentStr, string.Empty, string.Empty ); } // for i } // ToRow
/// <summary> /// Returns a <see cref="System.String" /> that represents this instance. /// </summary> /// <returns>A <see cref="System.String" /> that represents this instance.</returns> public override string ToString() { return(CustomerID.ToString()); }
public override string ToString() { return("CustomerID: " + CustomerID.ToString() + ", " + "Name: " + CustFirstName + " " + CustLastName); }
public override int GetHashCode() { int hash = 1; if (OrderID != 0) { hash ^= OrderID.GetHashCode(); } if (CustomerID.Length != 0) { hash ^= CustomerID.GetHashCode(); } if (EmployeeID != 0) { hash ^= EmployeeID.GetHashCode(); } if (orderDate_ != null) { hash ^= OrderDate.GetHashCode(); } if (requiredDate_ != null) { hash ^= RequiredDate.GetHashCode(); } if (shippedDate_ != null) { hash ^= ShippedDate.GetHashCode(); } if (ShipVia != 0) { hash ^= ShipVia.GetHashCode(); } if (Freight != 0D) { hash ^= pbc::ProtobufEqualityComparers.BitwiseDoubleEqualityComparer.GetHashCode(Freight); } if (ShipName.Length != 0) { hash ^= ShipName.GetHashCode(); } if (ShipAddress.Length != 0) { hash ^= ShipAddress.GetHashCode(); } if (ShipCity.Length != 0) { hash ^= ShipCity.GetHashCode(); } if (ShipRegion.Length != 0) { hash ^= ShipRegion.GetHashCode(); } if (ShipPostalCode.Length != 0) { hash ^= ShipPostalCode.GetHashCode(); } if (ShipCountry.Length != 0) { hash ^= ShipCountry.GetHashCode(); } hash ^= lines_.GetHashCode(); if (_unknownFields != null) { hash ^= _unknownFields.GetHashCode(); } return(hash); }
public override string ToString() { return CustomerID.ToString() + "," + CustomerName + "," + CustomerTypeID.ToString(); }
public override string ToString() { return($"Order [{ID}], By [Customer: {(Customer == null ? "Null" : $"{Customer?.ID.ToString() ?? "Null"}, {Customer?.FirstName?.ToString() ?? "Null"} {Customer?.LastName?.ToString() ?? "Null"}")}] [CustomerID: {CustomerID?.ToString() ?? "Null"}]"); }
public void InsertOrderDetils() { try { SqlParameter spDoc = new SqlParameter(); spDoc.ParameterName = "@DocumentID"; spDoc.SqlDbType = System.Data.SqlDbType.NVarChar; spDoc.Value = DocumentID; SqlParameter spLocationID = new SqlParameter(); spLocationID.ParameterName = "@LocationID"; spLocationID.SqlDbType = System.Data.SqlDbType.NVarChar; spLocationID.Value = LocationID; SqlParameter spStorageID = new SqlParameter(); spStorageID.ParameterName = "@StorageID"; spStorageID.SqlDbType = System.Data.SqlDbType.NVarChar; spStorageID.Value = StorageID; SqlParameter spTerminalID = new SqlParameter(); spTerminalID.ParameterName = "@TerminalID"; spTerminalID.SqlDbType = System.Data.SqlDbType.NVarChar; spTerminalID.Value = TerminalID; SqlParameter spCounter = new SqlParameter(); spCounter.ParameterName = "@Counter"; spCounter.SqlDbType = System.Data.SqlDbType.Int; spCounter.Value = Counter; SqlParameter spSalesOrder = new SqlParameter(); spSalesOrder.ParameterName = "@SalesOrder"; spSalesOrder.SqlDbType = System.Data.SqlDbType.NVarChar; spSalesOrder.Value = SalesOrder; SqlParameter spCompanyID = new SqlParameter(); spCompanyID.ParameterName = "@CompanyID"; spCompanyID.SqlDbType = System.Data.SqlDbType.NVarChar; spCompanyID.Value = CompanyID; SqlParameter spDoumentDate = new SqlParameter(); spDoumentDate.ParameterName = "@DocumentDate"; spDoumentDate.SqlDbType = System.Data.SqlDbType.DateTime; spDoumentDate.Value = DocumentDate; SqlParameter spPostingType = new SqlParameter(); spPostingType.ParameterName = "@PostingType"; spPostingType.SqlDbType = System.Data.SqlDbType.NVarChar; spPostingType.Value = PostingType; SqlParameter spCustomerID = new SqlParameter(); spCustomerID.ParameterName = "@CustomerID"; spCustomerID.SqlDbType = System.Data.SqlDbType.NVarChar; if (!CustomerID.Equals(string.Empty)) { spCustomerID.Value = CustomerID; } else { spCustomerID.Value = DBNull.Value; } SqlParameter spCategoryID = new SqlParameter(); spCategoryID.ParameterName = "@CategoryID"; spCategoryID.SqlDbType = System.Data.SqlDbType.NVarChar; spCategoryID.Value = CategoryID; SqlParameter spMaterialID = new SqlParameter(); spMaterialID.ParameterName = "@MaterialID"; spMaterialID.SqlDbType = System.Data.SqlDbType.NVarChar; spMaterialID.Value = MaterialID; SqlParameter spUOM = new SqlParameter(); spUOM.ParameterName = "@UOM"; spUOM.SqlDbType = System.Data.SqlDbType.NVarChar; spUOM.Value = UOM; SqlParameter spTranQty = new SqlParameter(); spTranQty.ParameterName = "@TranQty"; spTranQty.SqlDbType = System.Data.SqlDbType.Decimal; spTranQty.Value = TranQty; SqlParameter spBaseQty = new SqlParameter(); spBaseQty.ParameterName = "@BaseQty"; spBaseQty.SqlDbType = System.Data.SqlDbType.Decimal; spBaseQty.Value = BaseQty; SqlParameter spCreditQty = new SqlParameter(); spCreditQty.ParameterName = "@CreditQty"; spCreditQty.SqlDbType = System.Data.SqlDbType.Decimal; spCreditQty.Value = CreditQty; SqlParameter spCost = new SqlParameter(); spCost.ParameterName = "@Cost"; spCost.SqlDbType = System.Data.SqlDbType.Decimal; spCost.Value = Cost; SqlParameter spPrice = new SqlParameter(); spPrice.ParameterName = "@Price"; spPrice.SqlDbType = System.Data.SqlDbType.Decimal; spPrice.Value = Price; SqlParameter spDiscountRate = new SqlParameter(); spDiscountRate.ParameterName = "@DiscountRate"; spDiscountRate.SqlDbType = System.Data.SqlDbType.Decimal; spDiscountRate.Value = DiscountRate; SqlParameter spAmount = new SqlParameter(); spAmount.ParameterName = "@Amount"; spAmount.SqlDbType = System.Data.SqlDbType.Decimal; spAmount.Value = Amount; SqlParameter spCreditAmount = new SqlParameter(); spCreditAmount.ParameterName = "@CreditAmount"; spCreditAmount.SqlDbType = System.Data.SqlDbType.Decimal; spCreditAmount.Value = CreditAmount; SqlParameter spUserID = new SqlParameter(); spUserID.ParameterName = "@UserID"; spUserID.SqlDbType = System.Data.SqlDbType.NVarChar; spUserID.Value = UserID; SqlParameter spPostKey = new SqlParameter(); spPostKey.ParameterName = "@PostKey"; spPostKey.SqlDbType = System.Data.SqlDbType.Int; spPostKey.Value = PostKey; SqlParameter spAddDate = new SqlParameter(); spAddDate.ParameterName = "@AddDate"; spAddDate.SqlDbType = System.Data.SqlDbType.DateTime; spAddDate.Value = AddDate; SqlParameter spUpdDate = new SqlParameter(); spUpdDate.ParameterName = "@UpdDate"; spUpdDate.SqlDbType = System.Data.SqlDbType.DateTime; spUpdDate.Value = UpdDate; SqlParameter spPostingDate = new SqlParameter(); spPostingDate.ParameterName = "@PostingDate"; spPostingDate.SqlDbType = System.Data.SqlDbType.DateTime; spPostingDate.Value = DocumentDate; string InvoiceDtls = "Proc_InsertOrderDetails"; dcon.ConString = Datacon; dcon.CmdType = CommandType.StoredProcedure; dcon.CmdString = InvoiceDtls; dcon.InsertRecord(spDoc, spCompanyID, spLocationID, spStorageID, spTerminalID, spDoumentDate, spPostingType, spCustomerID, spCounter, spCategoryID, spMaterialID, spPostingDate, spUOM, spTranQty, spBaseQty, spCreditQty, spCost, spPrice, spDiscountRate, spAmount, spCreditAmount, spUserID, spPostKey, spAddDate, spUpdDate); UpdateReadOrderdtls(); } catch (Exception ex) { string _Ex = ex.Message; string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Sales_Detail'. Cannot insert duplicate key in object 'dbo.tbl_Sales_Detail'.\r\nThe statement has been terminated."; if (_Error.Equals(_Ex)) { UpdateReadOrderdtls(); } else { throw; } } }
public override int GetHashCode() { return(CustomerID.GetHashCode()); }
public int CompareTo(Customer other) => other == null ? 1 : CustomerID.CompareTo(other.CustomerID);
public void Dispose() { _AllList.Remove(this); _AllByPrimaryKey.Remove(CustomerID.ToString()); }
public override int GetHashCode() => CustomerID.GetHashCode();
public DataTable InsertInvoice() { DataTable dtInvoice = null; try { SqlParameter spDoc = new SqlParameter(); spDoc.ParameterName = "@DocumentId"; spDoc.SqlDbType = System.Data.SqlDbType.NVarChar; spDoc.Value = DocumentID; SqlParameter spSalesOrder = new SqlParameter(); spSalesOrder.ParameterName = "@SalesOrder"; spSalesOrder.SqlDbType = System.Data.SqlDbType.NVarChar; spSalesOrder.Value = SalesOrder; SqlParameter spCompanyId = new SqlParameter(); spCompanyId.ParameterName = "@CompanyId"; spCompanyId.SqlDbType = System.Data.SqlDbType.NVarChar; spCompanyId.Value = CompanyID; SqlParameter spLocationId = new SqlParameter(); spLocationId.ParameterName = "@LocationId"; spLocationId.SqlDbType = System.Data.SqlDbType.NVarChar; spLocationId.Value = LocationID; SqlParameter spStorageId = new SqlParameter(); spStorageId.ParameterName = "@StorageId"; spStorageId.SqlDbType = System.Data.SqlDbType.NVarChar; spStorageId.Value = StorageID; SqlParameter spTerminalId = new SqlParameter(); spTerminalId.ParameterName = "@TerminalId"; spTerminalId.SqlDbType = System.Data.SqlDbType.NVarChar; spTerminalId.Value = TerminalID; SqlParameter spCustomerId = new SqlParameter(); spCustomerId.ParameterName = "@CustomerId"; spCustomerId.SqlDbType = System.Data.SqlDbType.NVarChar; if (!CustomerID.Equals(string.Empty)) { spCustomerId.Value = CustomerID; } else { spCustomerId.Value = DBNull.Value; } SqlParameter spDocDetail = new SqlParameter(); spDocDetail.ParameterName = "@DocDetail"; spDocDetail.SqlDbType = System.Data.SqlDbType.NVarChar; spDocDetail.Value = DocDetail; SqlParameter SpDocDate = new SqlParameter(); SpDocDate.ParameterName = "@DocDate"; SpDocDate.SqlDbType = System.Data.SqlDbType.DateTime; SpDocDate.Value = DocumentDate; SqlParameter SpPostDate = new SqlParameter(); SpPostDate.ParameterName = "@PostDate"; SpPostDate.SqlDbType = System.Data.SqlDbType.DateTime; SpPostDate.Value = PostingDate; SqlParameter SpAddDate = new SqlParameter(); SpAddDate.ParameterName = "@AddDate"; SpAddDate.SqlDbType = System.Data.SqlDbType.DateTime; SpAddDate.Value = AddDate; SqlParameter SpUser = new SqlParameter(); SpUser.ParameterName = "@UserId"; SpUser.SqlDbType = System.Data.SqlDbType.NVarChar; SpUser.Value = UserID; SqlParameter SpAmount = new SqlParameter(); SpAmount.ParameterName = "@Amount"; SpAmount.SqlDbType = System.Data.SqlDbType.Decimal; SpAmount.Value = Amount; SqlParameter SpDiscount = new SqlParameter(); SpDiscount.ParameterName = "@Discount"; SpDiscount.SqlDbType = System.Data.SqlDbType.Decimal; SpDiscount.Value = Discount; SqlParameter SpNetValue = new SqlParameter(); SpNetValue.ParameterName = "@NetValue"; SpNetValue.SqlDbType = System.Data.SqlDbType.Decimal; SpNetValue.Value = NetValue; string invoice = "INSERT INTO TBL_SALES (DOCUMENTID,SALESORDER,COMPANYID,LOCATIONID,STORAGEID,TERMINALID," + " DOCUMENTDATE,POSTINGDATE,CUSTOMERID,DOCDETAIL,AMOUNT,DISCOUNT,NETVALUE,USERID,ADDDATE) VALUES " + " (@DOCUMENTID,@SALESORDER,@COMPANYID,@LOCATIONID,@STORAGEID,@TERMINALID," + "@DOCDATE,@POSTDATE,@CUSTOMERID,@DOCDETAIL,@AMOUNT,@DISCOUNT,@NETVALUE,@USERID,@ADDDATE)"; datacon1.ConString = ConfigurationManager.ConnectionStrings["ConnectionStringSvr"].ToString(); datacon1.CmdType = CommandType.Text; datacon1.CmdString = invoice; datacon1.InsertRecord(spDoc, spSalesOrder, spCompanyId, spLocationId, spStorageId, spTerminalId, SpDocDate, SpPostDate, spCustomerId, spDocDetail, SpAmount, SpDiscount, SpNetValue, SpUser, SpAddDate); UpdateReadSales(); // string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Sales'. Cannot insert duplicate key in object 'dbo.tbl_Sales'.The statement has been terminated."; } catch (Exception ex) { string _Ex = ex.Message; string _Error = "Violation of PRIMARY KEY constraint 'PK_tbl_Sales'. Cannot insert duplicate key in object 'dbo.tbl_Sales'.\r\nThe statement has been terminated."; if (_Error.Equals(_Ex)) { UpdateReadSales(); } else { throw; } } return(dtInvoice); }
public List <WebUserRights> GetUserRightsOnPlatform(string token, string platformId) { List <WebUserRights> ReturnRightsForUser = new List <WebUserRights>(); List <CustomerID> objectList = new List <CustomerID>(); SqlConnection conn = new SqlConnection(ConnectionString); #region GetAllCustID try { System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine(@"select DISTINCT scu_CustomerID from SSO_TOKENS inner join SSO_CUSTOMER_USERS on SSO_CUSTOMER_USERS.scu_UserGUID = SSO_TOKENS.st_UserID INNER JOIN SSO_CUSTOMER_APPLICATIONS ON scu_CustomerID = sca_CustomerId WHERE SSO_TOKENS.st_GUID = '" + token + @"' AND SSO_CUSTOMER_APPLICATIONS.sca_AplicationID = '" + platformId + "'"); SqlCommand comm = conn.CreateCommand(); comm.CommandText = sql.ToString(); comm.CommandType = CommandType.Text; conn.Open(); SqlDataReader reader = comm.ExecuteReader(); while (reader.Read()) { CustomerID customObject = new CustomerID() { // srt_id = Convert.ToInt32(reader["srt_id"]), ID = reader["scu_CustomerID"].ToString(), }; objectList.Add(customObject); } } catch (SqlException ex) { throw ex; } finally { if (conn != null) { conn.Close(); } } #endregion #region CreateListOfRights foreach (CustomerID Customer in objectList) { try { System.Text.StringBuilder sql = new System.Text.StringBuilder(); sql.AppendLine(@"select SSO_APPLICATION_RIGHTS.sar_Nomination, (select sart_name from SSO_APPLICATION_RIGHT_TYPE where sart_ID = SSO_APPLICATION_RIGHTS.sar_SART_ID) as [role] from SSO_TOKENS inner join SSO_CUSTOMER_USERS on SSO_CUSTOMER_USERS.scu_UserGUID = SSO_TOKENS.st_UserID INNER JOIN SSO_CUSTOMER_APPLICATIONS ON scu_CustomerID = sca_CustomerId inner join SSO_APPLICATION_RIGHTS on SSO_CUSTOMER_APPLICATIONS.sca_AplicationID = SSO_APPLICATION_RIGHTS.sar_SA_ID inner join SSO_USER_RIGHTS on SSO_USER_RIGHTS.sur_SCU_ID = SSO_CUSTOMER_USERS.scu_ID and SSO_USER_RIGHTS.sur_SCA_ID = SSO_CUSTOMER_APPLICATIONS.sca_Id and SSO_USER_RIGHTS.sur_SAR_ID = SSO_APPLICATION_RIGHTS.sar_ID WHERE SSO_TOKENS.st_GUID = '" + token + "' AND SSO_CUSTOMER_APPLICATIONS.sca_AplicationID = '" + platformId + @"' and SSO_USER_RIGHTS.sur_Active = 1 and SSO_CUSTOMER_APPLICATIONS.sca_IsEnabled= 1 "); SqlCommand comm = conn.CreateCommand(); comm.CommandText = sql.ToString(); comm.CommandType = CommandType.Text; conn.Open(); SqlDataReader reader = comm.ExecuteReader(); List <UserRightsObject> UserRightsVector = new List <UserRightsObject>(); while (reader.Read()) { UserRightsObject customObjectUserRights = new UserRightsObject() { // srt_id = Convert.ToInt32(reader["srt_id"]), RightType = reader["sar_Nomination"].ToString(), Right = reader["role"].ToString(), }; UserRightsVector.Add(customObjectUserRights); } WebUserRights z = new WebUserRights(); z.CustomerId = Customer.ID; z.UserRightsVector = UserRightsVector; ReturnRightsForUser.Add(z); } catch (SqlException ex) { throw ex; } finally { if (conn != null) { conn.Close(); } } } #endregion return(ReturnRightsForUser); }