public void r102Implementation(ApprovalExceptionOrdersModel instance) { // This is the placeholder for method implementation. Finsoft.Data.PageRequest page = (Finsoft.Data.PageRequest)Context.Items["PageRequest_Current"]; if (page.View == "editForm1") { if (instance.OrderHedID != null) { var custInfo = SqlText.Execute("select * from vwCustomer a inner join OrderHed b On a.SysRowID=b.CustSysRowID where b.OrderHedID=@OrderHedID", new { OrderHedID = instance.OrderHedID }); if (custInfo != null) { instance.CAddress1 = custInfo[5].ToString(); instance.CAddress2 = custInfo[6].ToString(); instance.CAddress3 = custInfo[7].ToString(); instance.CCity = custInfo[8].ToString(); instance.CState = custInfo[9].ToString(); instance.CZip = custInfo[10].ToString(); instance.CCountry = custInfo[11].ToString(); instance.CreditLimit = Convert.ToDecimal(custInfo[14]); instance.Balance = Convert.ToDecimal(custInfo[13]); instance.UnPaidInvoices = Convert.ToDecimal(custInfo[15]); instance.OutStandingOrders = Convert.ToDecimal(custInfo[16]); instance.UnPostedInvoices = Convert.ToDecimal(custInfo[17]); instance.AgeCurr = Convert.ToDecimal(custInfo[18]); instance.Age30 = Convert.ToDecimal(custInfo[19]); instance.Age60 = Convert.ToDecimal(custInfo[20]); instance.Age90 = Convert.ToDecimal(custInfo[21]); instance.Age120 = Convert.ToDecimal(custInfo[22]); instance.Age150 = Convert.ToDecimal(custInfo[23]); instance.TermsExceed = Convert.ToBoolean(custInfo[24]); instance.PhoneNum = custInfo[26].ToString(); instance.FaxNum = custInfo[27].ToString(); } } if (instance.OrderHedID != null) { var shipInfo = SqlText.Execute("select * from vwShipTo a inner join OrderHed b On a.SysRowID=b.ShipToSysRowID where b.OrderHedID=@OrderHedID", new { OrderHedID = instance.OrderHedID }); if (shipInfo != null) { instance.SAddress1 = shipInfo[6].ToString(); instance.SAddress2 = shipInfo[7].ToString(); instance.SAddress3 = shipInfo[8].ToString(); instance.SCity = shipInfo[9].ToString(); instance.SState = shipInfo[10].ToString(); instance.SZip = shipInfo[11].ToString(); instance.SCountry = shipInfo[12].ToString(); instance.SPhoneNum = shipInfo[14].ToString(); instance.SFaxNum = shipInfo[15].ToString(); } } } }
public void r100Implementation(OrderHeaderModel instance) { // This is the placeholder for method implementation. string CompQry = string.Format("select isnull(Count(a.CompanyName),0) from Company a inner join UsersCompany b on a.CompanyID=b.CompanyID inner join Users c on b.UserID=c.UserID Where c.UserName='******'", UserName); var CompCnt = (int)SqlText.ExecuteScalar(CompQry); if (CompCnt == 1) { string GetCompQry = string.Format("select a.CompanyID,a.CompanyName from Company a inner join UsersCompany b on a.CompanyID=b.CompanyID inner join Users c on b.UserID=c.UserID Where c.UserName='******'", UserName); var CompInfo = SqlText.Execute(GetCompQry); if (CompInfo != null) { instance.CompanyID = (int)CompInfo[0]; instance.CompanyName = (string)CompInfo[1]; } } instance.OrderDate = DateTime.Now; instance.ReqShipDate = DateTime.Now; instance.TargetReportingDate = DateTime.Now.AddDays(7); instance.BulkOrder = false; instance.OrderType = "N"; instance.OrderStatusID = 1; instance.OrderStatusName = "Open"; //instance.PromotionID = 1; //instance.PromotionTitle = "None"; if (UserIsInRole("SalesPerson")) { instance.Owner = UserName.ToUpper(); if (UserName == "YS.LAI") { instance.CurUser = "******"; } else { instance.CurUser = UserName.ToUpper(); } } instance.Creator = UserName; instance.CreatedOn = DateTime.Now; }
public void r100Implementation(OrderHedModel instance) { // This is the placeholder for method implementation. string CompQry = string.Format("select isnull(Count(a.CompanyName),0) from Company a inner join UsersCompany b on a.CompanyID=b.CompanyID inner join Users c on b.UserID=c.UserID Where c.UserName='******'", UserName); var CompCnt = (int)SqlText.ExecuteScalar(CompQry); if (CompCnt == 1) { string GetCompQry = string.Format("select a.CompanyID,a.CompanyName from Company a inner join UsersCompany b on a.CompanyID=b.CompanyID inner join Users c on b.UserID=c.UserID Where c.UserName='******'", UserName); var CompInfo = SqlText.Execute(GetCompQry); if (CompInfo != null) { instance.CompanyID = (int)CompInfo[0]; instance.CompanyName = (string)CompInfo[1]; } } instance.OrderDate = DateTime.Now; instance.ReqShipDate = DateTime.Now; instance.BulkOrder = false; instance.OrderType = "Normal"; instance.OrderStatusID = 1; instance.OrderStatusName = "Open"; }
public void r102Implementation(OrderHeaderModel instance) { // This is the placeholder for method implementation. //ActionArgs test = Arguments; //HttpContext http = Context; //http.Items["PageRequest_Current"]).Controller //http.Items["PageRequest_Current"]; Finsoft.Data.PageRequest page = (Finsoft.Data.PageRequest)Context.Items["PageRequest_Current"]; string viewName = page.View; if (page.View == "editForm1") { if (instance.CustSysRowID != null) { var custInfo = SqlText.Execute("select * from vwCustomer where SysRowID=@CustSysRowID", new { CustSysRowID = instance.CustSysRowID }); if (custInfo != null) { instance.CAddress1 = custInfo[5].ToString(); instance.CAddress2 = custInfo[6].ToString(); instance.CAddress3 = custInfo[7].ToString(); instance.CCity = custInfo[8].ToString(); instance.CState = custInfo[9].ToString(); instance.CZip = custInfo[10].ToString(); instance.CCountry = custInfo[11].ToString(); instance.CreditLimit = Convert.ToDecimal(custInfo[14]); instance.Balance = Convert.ToDecimal(custInfo[13]); instance.UnPaidInvoices = Convert.ToDecimal(custInfo[15]); instance.OutStandingOrders = Convert.ToDecimal(custInfo[16]); instance.UnPostedInvoices = Convert.ToDecimal(custInfo[17]); instance.AgeCurr = Convert.ToDecimal(custInfo[18]); instance.Age30 = Convert.ToDecimal(custInfo[19]); instance.Age60 = Convert.ToDecimal(custInfo[20]); instance.Age90 = Convert.ToDecimal(custInfo[21]); instance.Age120 = Convert.ToDecimal(custInfo[22]); instance.Age150 = Convert.ToDecimal(custInfo[23]); instance.TermsExceed = Convert.ToBoolean(custInfo[24]); instance.PhoneNum = custInfo[26].ToString(); instance.FaxNum = custInfo[27].ToString(); } } if (instance.ShipToSysRowID != null) { var shipInfo = SqlText.Execute("select * from vwShipTo where SysRowID=@ShipToSysRowID ", new { ShipToSysRowID = instance.ShipToSysRowID }); if (shipInfo != null) { instance.SAddress1 = shipInfo[6].ToString(); instance.SAddress2 = shipInfo[7].ToString(); instance.SAddress3 = shipInfo[8].ToString(); instance.SCity = shipInfo[9].ToString(); instance.SState = shipInfo[10].ToString(); instance.SZip = shipInfo[11].ToString(); instance.SCountry = shipInfo[12].ToString(); instance.SPhoneNum = shipInfo[14].ToString(); instance.SFaxNum = shipInfo[15].ToString(); } } int i = (int)SqlText.ExecuteScalar("Select isnull(Count(OrderDtlID),0) from OrderDtl Where OrderHedID=@OrderHedID", instance.OrderHedID); if (i > 0) { //NodeSet().SelectViews("grid1", "editForm1").SelectDataFields("CustSysRowID").SetTextMode("Static"); //NodeSet().SelectViews("grid1", "editForm1").SelectDataFields("ShipToSysRowID").SetTextMode("Static"); instance.IsOrderLinesCreated = true; } else { //NodeSet().SelectViews("grid1", "editForm1").SelectDataFields("CustSysRowID").SetTextMode("Auto"); //NodeSet().SelectViews("grid1", "editForm1").SelectDataFields("ShipToSysRowID").SetTextMode("Auto"); instance.IsOrderLinesCreated = false; } if (UserIsInRole("SalesPerson")) { if (UserName == "YS.LAI") { instance.CurUser = "******"; } else { instance.CurUser = UserName.ToUpper(); } } } }
public void r106Implementation(OrderDtlModel instance) { // This is the placeholder for method implementation. if (Arguments.CommandArgument == "PartSysRowID") { //instance.PartNum = null; //instance.PartDescription = null; instance.ChangeBasePrice = false; instance.ChangeSellingPrice = false; instance.ProposedBasePrice = null; instance.ProposedSellingPrice = null; instance.ProposedSellingPricePerBottle = null; instance.ProposedBasePricePerBottle = null; string priceLstQry = string.Format("SELECT isnull(BasePrice,0) , isnull(Price,0), isnull(SellingPricePerBottle,0), isnull(BasePricePerBottle,0) FROM vwPriceList WHERE Company='{0}' and CustNum={1} and PartNum='{2}' ", instance.OHCompany, instance.OHCustNum, instance.PartNum); var priceLst = SqlText.Execute(priceLstQry); if (priceLst != null) { instance.BasePrice = (decimal)priceLst[0]; instance.SellingPrice = (decimal)priceLst[1]; instance.SellingPricePerBottle = (decimal)priceLst[2]; instance.BasePricePerBottle = (decimal)priceLst[3]; instance.Amount = instance.SellingPrice * instance.OrderQty; instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; } } if (Arguments.CommandArgument == "ChangeSellingPrice") { if (instance.ChangeSellingPrice == null) { instance.ProposedSellingPrice = null; instance.ProposedSellingPricePerBottle = null; instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; } if (instance.ChangeSellingPrice != null && !(bool)instance.ChangeSellingPrice) { instance.ProposedSellingPrice = null; instance.ProposedSellingPricePerBottle = null; instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; } } if (Arguments.CommandArgument == "ChangeBasePrice") { if (instance.ChangeBasePrice != null && !(bool)instance.ChangeBasePrice) { instance.ProposedBasePrice = null; instance.ProposedBasePricePerBottle = null; } } if (Arguments.CommandArgument == "OrderQty") { instance.Amount = instance.SellingPrice * instance.OrderQty; //instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; if (instance.ProposedSellingPrice != null && instance.CtnConv != null && instance.ProposedSellingPrice > 0 && instance.CtnConv > 0) { instance.ProposedSellingPricePerBottle = instance.ProposedSellingPrice / instance.CtnConv; instance.ProposedAmount = instance.ProposedSellingPrice * instance.OrderQty; } else { instance.ProposedSellingPricePerBottle = null; instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; } } if (Arguments.CommandArgument == "ProposedSellingPrice") { if (instance.ProposedSellingPrice != null && instance.CtnConv != null && instance.ProposedSellingPrice > 0 && instance.CtnConv > 0) { instance.ProposedSellingPricePerBottle = instance.ProposedSellingPrice / instance.CtnConv; instance.ProposedAmount = instance.ProposedSellingPrice * instance.OrderQty; } else { instance.ProposedSellingPricePerBottle = null; instance.ProposedAmount = instance.SellingPrice * instance.OrderQty; } } if (Arguments.CommandArgument == "ProposedBasePrice") { if (instance.ProposedBasePrice != null && instance.CtnConv != null && instance.ProposedBasePrice > 0 && instance.CtnConv > 0) { instance.ProposedBasePricePerBottle = instance.ProposedBasePrice / instance.CtnConv; } else { instance.ProposedBasePricePerBottle = null; } } }