//public string InquireRequisition(string ReqID, string UserName, string Password) //{ // string returnValue = string.Empty; // ERMA.IVRequisition.ivpwsNPO001PortTypeClient client = new ERMA.IVRequisition.ivpwsNPO001PortTypeClient("ivpwsNPO001HttpSoap12Endpoint"); // // set so that service manager uses custom credentials class instead of default. // client.ChannelFactory.Endpoint.Behaviors.Remove<System.ServiceModel.Description.ClientCredentials>(); // client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials()); // // set the credentials and path to the certificate. // client.ClientCredentials.UserName.UserName = UserName; // client.ClientCredentials.UserName.Password = Password; // client.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.X509FindType.FindBySerialNumber, "4d 00 eb c7"); // InquirePoRequisitionerCodeRequest request = new InquirePoRequisitionerCodeRequest(); // //Service_UpdatePORequisitionType // UpdatePORequisitionRequest requisitionRequest = new UpdatePORequisitionRequest(); // return string.Empty; //} public string AddRequisition(ReqDetail rd, string UserName, string Password) { string returnValue = string.Empty; ERMA.IVRequisition.ivpwsNPO001PortTypeClient client = new ERMA.IVRequisition.ivpwsNPO001PortTypeClient("ivpwsNPO001HttpSoap12Endpoint"); // set so that service manager uses custom credentials class instead of default. client.ChannelFactory.Endpoint.Behaviors.Remove <System.ServiceModel.Description.ClientCredentials>(); client.ChannelFactory.Endpoint.Behaviors.Add(new CustomCredentials()); // set the credentials and path to the certificate. client.ClientCredentials.UserName.UserName = UserName; client.ClientCredentials.UserName.Password = Password; client.ClientCredentials.ClientCertificate.SetCertificate(System.Security.Cryptography.X509Certificates.StoreLocation.LocalMachine, System.Security.Cryptography.X509Certificates.StoreName.My, System.Security.Cryptography.X509Certificates.X509FindType.FindBySerialNumber, "4d 00 eb c7"); AddPORequisitionRequest request = new AddPORequisitionRequest(); Service_AddPORequisitionType addReq = new Service_AddPORequisitionType(); //InquirePoRequisitionerCodeRequest addReq.ServPlntCod = rd.ServPlntCode; addReq.ServLang = rd.ServLang; addReq.MasterRequisitionNbrSpecified = rd.MasterRequisitionNbrSpecified; addReq.CMSDataBase = rd.CMSDatabase; addReq.MasterRequisitionNbr = rd.MasterRequisitionNumber; addReq.RequestID = rd.RequestID; addReq.RequestMode = rd.RequestMode; addReq.PlantCode = rd.ServPlntCode; //DFT addReq.ItemType = " "; addReq.RequisitionNumberSpecified = rd.RequisitionNumberSpecified; addReq.VendorPartNumber = rd.VendorPartNumber; addReq.PartNumber = rd.TACPartNumber; addReq.QuantityOrdered = rd.Qty; addReq.QuantityOrderedSpecified = rd.QtyOrderedSpecified; addReq.PriceUnit = rd.UnitOfMeasure; addReq.OrderUnit = rd.OrderUnit; addReq.UnitPrice = Convert.ToDecimal(rd.PerUnitPrice); addReq.UnitPriceSpecified = true; addReq.DateRequired = rd.RequiredDate; if (!(rd.ProjectCode is null)) { if (rd.ProjectCode != "0") { addReq.ProjectNumber = rd.ProjectCode.Trim().ToUpper(); } else { addReq.ProjectNumber = ""; } }
public static string UpdateRequisitionApproval(ReqDetail req, string ApprovedBy, string schema) { StringBuilder sb = new StringBuilder(); sb.Append("UPDATE " + schema + ".PORQI "); sb.Append("SET JIAPRV = '" + req.ApprovedStatus + "' "); sb.Append(", JIAPBY = '" + ApprovedBy + "' "); sb.Append("WHERE JIREQ# = '" + req.RequisitionNumber.ToString() + "' "); return(sb.ToString()); }
public void SaveUpdateReqDetail(ReqDetail obReqDetail, SqlConnection con, SqlTransaction trans) { SqlCommand com = null; try { com = new SqlCommand("spSaveUpdateReqDetail", con, trans); com.CommandType = CommandType.StoredProcedure; com.Parameters.Add("@ReqDID", SqlDbType.Int).Value = obReqDetail.ReqDID; com.Parameters.Add("@ReqMID", SqlDbType.Int).Value = obReqDetail.ReqMID; com.Parameters.Add("@ItemID", SqlDbType.Int).Value = obReqDetail.ItemID; com.Parameters.Add("@ReqQty", SqlDbType.Money).Value = obReqDetail.ReqQty; com.Parameters.Add("@UnitID", SqlDbType.Int).Value = obReqDetail.UnitID; com.Parameters.Add("@Remarks", SqlDbType.VarChar, 500).Value = obReqDetail.Remarks; com.Parameters.Add("@ColorCode", SqlDbType.VarChar, 100).Value = obReqDetail.ColorCode; com.Parameters.Add("@Labdip", SqlDbType.VarChar, 500).Value = obReqDetail.Labdip; if (obReqDetail.ColorID == 0) { com.Parameters.Add("@ColorID", SqlDbType.Int).Value = DBNull.Value; } else { com.Parameters.Add("@ColorID", SqlDbType.Int).Value = obReqDetail.ColorID; } if (obReqDetail.CountID == 0) { com.Parameters.Add("@CountID", SqlDbType.Int).Value = DBNull.Value; } else { com.Parameters.Add("@CountID", SqlDbType.Int).Value = obReqDetail.CountID; } if (obReqDetail.SizeID == 0) { com.Parameters.Add("@SizeID", SqlDbType.Int).Value = DBNull.Value; } else { com.Parameters.Add("@SizeID", SqlDbType.Int).Value = obReqDetail.SizeID; } com.ExecuteNonQuery(); } catch (Exception ex) { throw new Exception(ex.Message); } }
public ActionResult Create() { try { sc.CheckSecurity(AppRoles.All, Session[SessionName.UserName.ToString()].ToString()); } catch { return(RedirectToAction("Login", "Home")); } ReqDetail rd = new ReqDetail(); rd.RequisitionNumber = 0; rd.RequestID = "ReqID".ToUniqueID(); rd.RequestMode = "ReqModeID".ToUniqueID(); rd.CMSDatabase = Properties.Settings.Default.DB2Database.ToString(); rd.Qty = 1; rd.UnitOfMeasure = "EA"; rd.OrderUnit = "EA"; rd.RequiredDate = DateTime.Now.AddDays(30); rd.InventoryStockroom = "DFTSTK"; rd.Buyer = "SYS"; ViewBag.ShowPrice = "block"; ViewBag.ShowLineItemPrice = "none"; //rd.GlAccount = 86833430; Requisitioner rq = new Requisitioner(); string u = System.Security.Principal.WindowsIdentity.GetCurrent().Name.ToString().ToUserIDWithoutDomain().ToUpper(); //In case we ever want to use Windows Login ID u = Session[SessionName.UserName.ToString()].ToString().ToUpper(); //Use the CMS User name rq = reqRepository.GetRequisitionerByID(u); rd.Requisitioner = rq.ID; rd.GLAccountList.Clear(); rd.GLAccountList = glRepository.GetGLAccountList(u); rd.UoMList.Clear(); rd.UoMList = uomRepository.GetUoMList(); rd.TaxGroupList.Clear(); rd.TaxGroupList = tgRepository.GetTaxGroupList(); rd.ProjectList.Clear(); rd.ProjectList = prjRepository.GetProjectList(u); try { if (!(Session[SessionName.GLAccount.ToString()] is null)) { rd.GlAccount = Convert.ToDecimal(Session[SessionName.GLAccount.ToString()].ToString()); rd.DeptCode = GetDeptCode(rd.GlAccount); } else { var item = rd.GLAccountList.FirstOrDefault(); rd.GlAccount = item.Number; rd.DeptCode = GetDeptCode(rd.GlAccount); } if (!(Session[SessionName.DateRequired.ToString()] is null)) { rd.RequiredDate = Convert.ToDateTime(Session[SessionName.DateRequired.ToString()].ToString()); } if (!(Session[SessionName.Dept.ToString()] is null)) { rd.DeptCode = Session[SessionName.Dept.ToString()].ToString(); } if (!(Session[SessionName.VendorCode.ToString()] is null)) { rd.VendorCode = Session[SessionName.VendorCode.ToString()].ToString(); Vendor vndr = vnRepository.GetVendorByID(rd.VendorCode); rd.VendorName = vndr.VendorName; rd.TaxGroupCode = vndr.TaxGroupCode; if (rd.TaxGroupCode.Length > 0) { rd.TaxRateList.Clear(); rd.TaxRateList = trRepository.GetTaxRateList(rd.TaxGroupCode); } else { rd.TaxRateList.Clear(); } rd.VendorPartList.Clear(); rd.VendorPartList = vpRepository.GetVendorPartList(string.Empty, rd.VendorCode); } if (!(Session[SessionName.ProjectCode.ToString()] is null)) { rd.ProjectCode = Session[SessionName.ProjectCode.ToString()].ToString(); } }