protected void Button_Add_Spec_Click(object sender, EventArgs e) { BackEndObjects.Id IdGen = new BackEndObjects.Id(); String specId = IdGen.getNewId(BackEndObjects.Id.ID_TYPE_SPEC_SRING); ArrayList dimn = new ArrayList(); dimn.Add(TextBox11.Text); dimn.Add(TextBox12.Text); dimn.Add(TextBox13.Text); BackEndObjects.Specifications spec = new BackEndObjects.Specifications(); spec.setSpecName(TextBox10.Text); spec.setDimensions(dimn); spec.setSpecId(specId); ArrayList specList = new ArrayList(); specList.Add(spec); try { BackEndObjects.Features.insertSpecforFeatureDB(DropDownList2.SelectedValue, specList); Label2.Visible = true; Label2.Text = "Data Inserted Successfully"; Label2.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { Label2.Visible = true; Label2.Text = "Data Insertion Failed"; Label2.ForeColor = System.Drawing.Color.Green; } }
protected void Button_Add_Feat_Click(object sender, EventArgs e) { BackEndObjects.Id IdGen = new BackEndObjects.Id(); String ftId = IdGen.getNewId(BackEndObjects.Id.ID_TYPE_FEAT_STRING); BackEndObjects.Features ft = new BackEndObjects.Features(); ft.setFeatureId(ftId); ft.setFeatureName(TextBox8.Text); ft.setWeightage(TextBox9.Text); try { BackEndObjects.Features.insertFeatureDB(ft); Label1.Visible = true; Label1.ForeColor = System.Drawing.Color.Green; Label1.Text = "Data Inserted Successfully"; ListItem ltFeat = new ListItem(); ltFeat.Value = ft.getFeatureId(); ltFeat.Text = ft.getFeatureName(); DropDownList1.Items.Add(ltFeat); DropDownList2.Items.Add(ltFeat); DropDownList1.SelectedIndex = 0; DropDownList2.SelectedIndex = 0; } catch (Exception ex) { Label1.Visible = true; Label1.ForeColor = System.Drawing.Color.Red; Label1.Text = "Data Insertion Failed"; } }
protected void Button_SO_Update_Click(object sender, EventArgs e) { String sectionTnC = Label_TNC_flag_SO.Text; Boolean insertFlag = sectionTnC.Equals("Y"); Boolean updateStat = true; ArrayList docFormatList = new ArrayList(); DocFormat sectionTnCObj = new DocFormat(); String docFormatId = ""; if (sectionTnC.Equals("Y")) { if (!TextBox_SO_format_name.Text.Equals("") && !TextBox_SO_TnC.Text.Equals("")) { docFormatId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING); sectionTnCObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); sectionTnCObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER); sectionTnCObj.setDocformat_id(docFormatId); sectionTnCObj.setDocformat_name(TextBox_SO_format_name.Text); sectionTnCObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER_SECTION_TYPE_TNC); sectionTnCObj.setText(TextBox_SO_TnC.Text); docFormatList.Add(sectionTnCObj); } } else { Dictionary <String, String> whereCls = new Dictionary <string, string>(); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_SALES_ORDER_SECTION_TYPE_TNC); Dictionary <String, String> targetVals = new Dictionary <string, string>(); targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_TEXT, TextBox_SO_TnC.Text); targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOCFORMAT_NAME, TextBox_SO_format_name.Text); BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_UPDATE); updateStat = true; } try { if (insertFlag) { BackEndObjects.DocFormat.insertDocFormatDB(docFormatList); } Label_SO_update_stat.Visible = true; Label_SO_update_stat.ForeColor = System.Drawing.Color.Green; Label_SO_update_stat.Text = "Updated Successfully"; } catch (Exception ex) { Label_SO_update_stat.Visible = true; Label_SO_update_stat.ForeColor = System.Drawing.Color.Red; Label_SO_update_stat.Text = "Update Failed"; } }
/// <summary> /// Pass required objects to ActionLibray registration method /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button_Register_Short_Click(object sender, EventArgs e) { ActionLibrary.RegistrationActions regstr = new ActionLibrary.RegistrationActions(); BackEndObjects.MainBusinessEntity mBE = new MainBusinessEntity(); userDetails udTest = BackEndObjects.userDetails.getUserDetailsbyIdDB(TextBox1.Text); if (udTest.getUserId() == null || udTest.getUserId().Equals("")) //New user id { mBE.setEntityName(TextBox5.Text); mBE.setEmailId(TextBox4.Text); mBE.setIndChain("I"); //This should later be allowed to be changed BackEndObjects.Id IdGen = new BackEndObjects.Id(); String mBEId = IdGen.getNewId(Id.ID_TYPE_CMP_USR_STRING); mBE.setEntityId(mBEId); Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] = mBEId; userDetails uD = new userDetails(); uD.setMainEntityId(mBEId); Random ranGen = new Random(); int saltInt = ranGen.Next(1, 16); byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes((TextBox2.Text.Equals("") ? TextBox2.Attributes["password"] : TextBox2.Text) + saltInt); HashAlgorithm hashConverter = new SHA256Managed(); byte[] hashedByteStream = hashConverter.ComputeHash(plainTextBytes); String encryptedAndConvertedPassword = Convert.ToBase64String(hashedByteStream); uD.setPassword(encryptedAndConvertedPassword); uD.setUserId(TextBox1.Text); //Set owner privilege for the first user by default uD.setPrivilege(BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS); uD.setSalt(saltInt.ToString()); ArrayList regstObjs = new ArrayList(); regstObjs.Add(mBE); regstObjs.Add(uD); regstr.completeRegr(regstObjs); Session[SessionFactory.SHORT_REGISTR_COMPLETE] = "true"; Label_UserId_Exists.Visible = true; Label_UserId_Exists.ForeColor = System.Drawing.Color.Green; Label_UserId_Exists.Text = "Registration Successful"; Button_Register_Short.Enabled = false; } else { Label_UserId_Exists.Visible = true; Label_UserId_Exists.Text = "User id is not available"; } }
protected void Button_Add_Category_Click(object sender, EventArgs e) { String catName = TextBox1.Text; String parentCatId = DropDownList2.SelectedValue; BackEndObjects.ProductCategory catObj = new BackEndObjects.ProductCategory(); catObj.setProductCategoryName(catName); catObj.setParentCategoryId(parentCatId); catObj.setVisible("T"); String catId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_PROD_CAT_STRING); catObj.setCategoryId(catId); ArrayList catList = new ArrayList(); catList.Add(catObj); try { BackEndObjects.ProductCategory.insertProductCategoryDB(catList); int[] FeatIdList = ListBoxFeat.GetSelectedIndices(); ArrayList catFeatObjList = new ArrayList(); for (int i = 0; i < FeatIdList.Length; i++) { String ftId = ListBoxFeat.Items[FeatIdList[i]].Value; BackEndObjects.CategoryFeatureMap catFeatMapObj = new BackEndObjects.CategoryFeatureMap(); catFeatMapObj.setFeatId(ftId); catFeatMapObj.setProdCatId(catId); catFeatObjList.Add(catFeatMapObj); } BackEndObjects.ProductCategory.insertFeaturesforCategory(catFeatObjList); Label5.Visible = true; Label5.Text = "Data Inserted Successfully"; Label5.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { Label5.Visible = true; Label5.Text = "Data Insertion Failed"; Label5.ForeColor = System.Drawing.Color.Red; } }
protected void createReq() { if (DropDownList_Level1.SelectedValue.Equals("_")) { Label_Status.Text = "Please select one product category"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; Button_Submit_Req.Enabled = true; Button_Submit_Next.Enabled = true; Button_Submit_Extra_Prd_Srv.Enabled = true; } else { BackEndObjects.Requirement reqObj = new BackEndObjects.Requirement(); BackEndObjects.Id idGen = new BackEndObjects.Id(); // String reqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_REQR_STRING); String reqId = ""; if (Session[SessionFactory.CREATE_REQ_REQR_ID] == null) { reqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_REQR_STRING); Session[SessionFactory.CREATE_REQ_REQR_ID] = reqId; //store the newly created RFQ id in the session } if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList reqrSpecObjList = (ArrayList)Session[SessionFactory.CREATE_REQ_SELECTED_REQR_SPEC_MAP]; //Set the requirement id for all the requirement spec objects //if(reqrSpecObjList!=null) //for(int i=0;i<reqrSpecObjList.Count;i++) //((BackEndObjects.Requirement_Spec)reqrSpecObjList[i]).setReqId(reqId); reqObj.setReqSpecs(reqrSpecObjList); //This setter method makes sure to add req id to all associated requirement spec objects if missing. reqObj.setReqId(reqId); reqObj.setCreatedUsr(User.Identity.Name); reqObj.setActiveStat(BackEndObjects.Requirement.REQ_ACTIVE_STAT_ACTIVE); reqObj.setDueDate(TextBox_Within_Date.Text); //Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString() //reqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); //Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString() reqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); String localId = (!DropDownList_Locality.SelectedValue.Equals("_") && !DropDownList_Locality.SelectedValue.Equals("") ? DropDownList_Locality.SelectedValue : (!DropDownList_City.SelectedValue.Equals("_") && !DropDownList_City.SelectedValue.Equals("") ? DropDownList_City.SelectedValue : (!DropDownList_State.SelectedValue.Equals("_") && !DropDownList_State.SelectedValue.Equals("") ? DropDownList_State.SelectedValue : (!DropDownList_Country.SelectedValue.Equals("_") && !DropDownList_Country.SelectedValue.Equals("") ? DropDownList_Country.SelectedValue : "")))); reqObj.setLocalId(localId); reqObj.setReqName(TextBox_Reqr_Name.Text); reqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); reqObj.setReqName(TextBox_Reqr_Name.Text); reqObj.setCurrency(DropDownList_Curr.SelectedValue); Dictionary <String, String> reqSpecUniqnessValidation = new Dictionary <string, string>(); if (reqrSpecObjList != null) { for (int i = 0; i < reqrSpecObjList.Count; i++) { BackEndObjects.Requirement_Spec reqrSpecObj = (BackEndObjects.Requirement_Spec)reqrSpecObjList[i]; if (reqSpecUniqnessValidation.ContainsKey(reqrSpecObj.getProdCatId() + ":" + reqrSpecObj.getFeatId())) { reqrSpecObjList.RemoveAt(i);//Remove the current requirement spec object from the list - otherwise it will cause exception at DB layer while inserting } else { reqSpecUniqnessValidation.Add(reqrSpecObj.getProdCatId() + ":" + reqrSpecObj.getFeatId(), ""); if (reqrSpecObj.getFileStream() != null) { reqrSpecObj.setImgPathInFileStore(reqObj.getEntityId()); } } } } BackEndObjects.RequirementProdServQnty reqProdSrvObj = new BackEndObjects.RequirementProdServQnty(); reqProdSrvObj.setRequirementId(reqObj.getReqId()); reqProdSrvObj.setProdCatId(Session[SessionFactory.CREATE_REQR_SELECTED_PRODUCT_CAT].ToString()); reqProdSrvObj.setFromPrice(TextBox_Price_Range_From.Text); reqProdSrvObj.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text)); reqProdSrvObj.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); reqProdSrvObj.setToPrice(TextBox_Price_Range_To.Text); reqProdSrvObj.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text)); ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_REQ_PROD_SRV_QNTY_LIST]; if (prodSrvQntyList == null) { prodSrvQntyList = new ArrayList(); } //Ensure that all objects in the arraylist has an associated rfqid for (int i = 0; i < prodSrvQntyList.Count; i++) { BackEndObjects.RequirementProdServQnty temp = (RequirementProdServQnty)prodSrvQntyList[i]; if (temp.getRequirementId() == null || temp.getRequirementId().Equals("")) { temp.setRequirementId(reqObj.getReqId()); } } prodSrvQntyList.Add(reqProdSrvObj); reqObj.setReqProdSrvQnty(prodSrvQntyList); ActionLibrary.PurchaseActions._createRequirements cR = new ActionLibrary.PurchaseActions._createRequirements(); try { cR.createNewRequirement(reqObj); Label_Status.Text = "Requirement created successfully"; Label_Status.ForeColor = System.Drawing.Color.Green; Label_Status.Visible = true; //Refresh the parent grid DataTable dt = (DataTable)Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_GRID_DATA]; Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST]; dt.Rows.Add(); int i = dt.Rows.Count - 1; DateUtility dU = new DateUtility(); dt.Rows[i]["Hidden"] = reqObj.getReqId(); dt.Rows[i]["Requirement Name"] = reqObj.getReqName(); dt.Rows[i]["curr"] = allCurrList.ContainsKey(reqObj.getCurrency()) ? allCurrList[reqObj.getCurrency()].getCurrencyName() : ""; dt.Rows[i]["Submit Date"] = reqObj.getSubmitDate(); dt.Rows[i]["Submit Date Ticks"] = Convert.ToDateTime(reqObj.getSubmitDate()).Ticks; dt.Rows[i]["Due Date"] = dU.getConvertedDateWoTime(reqObj.getDueDate()); dt.Rows[i]["Due Date Ticks"] = reqObj.getDueDate() != null && !reqObj.getDueDate().Equals("")? Convert.ToDateTime(dt.Rows[i]["Due Date"]).Ticks:0; dt.Rows[i]["Created By"] = reqObj.getCratedUsr(); dt.Rows[i]["Active?"] = reqObj.getActiveStat(); dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC"; Session[SessionFactory.ALL_PURCHASE_ALL_REQUIREMENT_GRID_DATA] = dt.DefaultView.ToTable(); ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshReqGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "Requirement creation failed"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; } finally { Session.Remove(SessionFactory.CREATE_REQ_SELECTED_REQR_SPEC_MAP); Session.Remove(SessionFactory.CREATE_REQ_REQR_ID); Session.Remove(SessionFactory.CREATE_RFQ_PROD_SRV_QNTY_LIST); } } }
protected void generateLead() { if (DropDownList_Level1.SelectedValue.Equals("_")) { Label_Status.Text = "Please select one product category"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; Button_Submit_Next0.Enabled = true; Button_Submit_Next.Enabled = true; Button_Submit_Extra_Prd_Srv.Enabled = true; } else { BackEndObjects.RFQDetails rfqObj = new BackEndObjects.RFQDetails(); BackEndObjects.Id idGen = new BackEndObjects.Id(); String rfqId = ""; if (Session[SessionFactory.CREATE_LEAD_RFQ_ID] == null) { rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING); Session[SessionFactory.CREATE_LEAD_RFQ_ID] = rfqId; //store the newly created RFQ id in the session } if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList rfqSpecObjList = (ArrayList)Session[SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP]; //Set the RFQ id for all the spec objects if (rfqSpecObjList != null) { for (int i = 0; i < rfqSpecObjList.Count; i++) { ((BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]).setRFQId(rfqId); } } rfqObj.setRFQProdServList(rfqSpecObjList); rfqObj.setRFQId(rfqId); rfqObj.setCreatedUsr(User.Identity.Name); rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE); rfqObj.setDueDate(TextBox_Within_Date.Text); //For Manually Created Lead entity id and CreateEntityId is different for the same rfq/lead object rfqObj.setEntityId(DropDownList_Contacts.SelectedValue); rfqObj.setCreatedEntity(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); // FileUpload1=(FileUpload1 == null ? (FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] : FileUpload1); String localId = (!DropDownList_Locality.SelectedValue.Equals("_") && !DropDownList_Locality.SelectedValue.Equals("") ? DropDownList_Locality.SelectedValue : (!DropDownList_City.SelectedValue.Equals("_") && !DropDownList_City.SelectedValue.Equals("") ? DropDownList_City.SelectedValue : (!DropDownList_State.SelectedValue.Equals("_") && !DropDownList_State.SelectedValue.Equals("") ? DropDownList_State.SelectedValue : (!DropDownList_Country.SelectedValue.Equals("_") && !DropDownList_Country.SelectedValue.Equals("") ? DropDownList_Country.SelectedValue:"")))); rfqObj.setLocalityId(localId); rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); rfqObj.setTermsandConds(TextBox_TnC.Text); rfqObj.setRFQName(TextBox_Reqr_Name.Text); rfqObj.setCreateMode(RFQDetails.CREATION_MODE_MANUAL); rfqObj.setCurrency(DropDownList_Curr.SelectedValue); BackEndObjects.RFQProdServQnty rfqPrdQnty = new BackEndObjects.RFQProdServQnty(); rfqPrdQnty.setRFQId(rfqObj.getRFQId()); rfqPrdQnty.setFromPrice(TextBox_Price_Range_From.Text); rfqPrdQnty.setToPrice(TextBox_Price_Range_To.Text); rfqPrdQnty.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text)); rfqPrdQnty.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text)); rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString()); //ArrayList rfqPrdQntyList = new ArrayList(); //rfqPrdQntyList.Add(rfqPrdQnty); ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_LEAD_PROD_SRV_QNTY_LIST]; if (prodSrvQntyList == null) { prodSrvQntyList = new ArrayList(); } prodSrvQntyList.Add(rfqPrdQnty); //Ensure that all objects in the arraylist has an associated rfqid for (int i = 0; i < prodSrvQntyList.Count; i++) { BackEndObjects.RFQProdServQnty temp = (RFQProdServQnty)prodSrvQntyList[i]; if (temp.getRFQId() == null || temp.getRFQId().Equals("")) { temp.setRFQId(rfqObj.getRFQId()); } } rfqObj.setRFQProdServQntyList(prodSrvQntyList); Dictionary <String, String> reqSpecUniqnessValidation = new Dictionary <string, string>(); if (rfqSpecObjList != null) { for (int i = 0; i < rfqSpecObjList.Count; i++) { BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]; if (reqSpecUniqnessValidation.ContainsKey(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId())) { rfqSpecObjList.RemoveAt(i);//Remove the current RFQ spec object from the list - otherwise it will cause exception at DB layer while inserting } else { reqSpecUniqnessValidation.Add(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId(), ""); if (rfqSpecObj.getFileStream() != null) { rfqSpecObj.setImgPathInFileStore(rfqObj.getEntityId()); } } } } BackEndObjects.RFQResponse leadRespObj = new RFQResponse(); leadRespObj.setRespEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); leadRespObj.setRFQId(Session[SessionFactory.CREATE_LEAD_RFQ_ID].ToString()); leadRespObj.setRespDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); leadRespObj.setNextFollowupDate(TextBox_Fwp_Date.Text); leadRespObj.setAssignedTo(DropDownList_Users.SelectedValue); //Load the document for the lead response if (FileUpload1 != null && FileUpload1.HasFile) { leadRespObj.setFileStream(FileUpload1); leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId()); } else if ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]).HasFile) { leadRespObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_LEAD_NDA_FILE]); leadRespObj.setNDADocPathInFileStore(leadRespObj.getRespEntityId()); } ArrayList leadRespQuoteList = (ArrayList)Session[SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST]; if (leadRespQuoteList == null) { leadRespQuoteList = new ArrayList(); } BackEndObjects.RFQResponseQuotes respQuoteObj = new RFQResponseQuotes(); respQuoteObj.setPrdCatId(Session[SessionFactory.CREATE_LEAD_SELECTED_PRODUCT_CAT].ToString()); respQuoteObj.setQuote((TextBox_Quote_Amnt.Text.Equals("") ? "0" : TextBox_Quote_Amnt.Text)); respQuoteObj.setResponseEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); respQuoteObj.setResponseUsrId(User.Identity.Name); //respQuoteObj.setUnitName(Session[SessionFactory.CREATE_LEAD_QUOTE_UNIT].ToString()); respQuoteObj.setUnitName(Label_Per_Unit.Text); respQuoteObj.setProductName((!TextBox_Prod_Name.Text.Equals("") ? TextBox_Prod_Name.Text.Trim() : DropDownList_Prod_List.SelectedItem.Text)); leadRespQuoteList.Add(respQuoteObj); //Ensure that all objects in the arraylist has an associated rfqid for (int i = 0; i < leadRespQuoteList.Count; i++) { BackEndObjects.RFQResponseQuotes temp = (RFQResponseQuotes)leadRespQuoteList[i]; if (temp.getRFQId() == null || temp.getRFQId().Equals("")) { temp.setRFQId(rfqObj.getRFQId()); } } leadRespObj.setResponseQuoteList(leadRespQuoteList); ActionLibrary.SalesActions._createLeads cL = new ActionLibrary.SalesActions._createLeads(); LeadRecord leadObj = new LeadRecord(); leadObj.setRFQProdServList(rfqObj.getRFQProdServList()); leadObj.setRFQId(rfqObj.getRFQId()); leadObj.setActiveStat(rfqObj.getActiveStat()); leadObj.setApprovalStat(rfqObj.getApprovalStat()); leadObj.setCreatedEntity(rfqObj.getCreatedEntity()); leadObj.setCreatedUsr(rfqObj.getCreatedUsr()); leadObj.setCreateMode(rfqObj.getCreateMode()); leadObj.setDueDate(rfqObj.getDueDate()); leadObj.setEntityId(rfqObj.getEntityId()); leadObj.setFileStream(rfqObj.getFileStream()); leadObj.setLocalityId(rfqObj.getLocalityId()); leadObj.setNDADocPath(rfqObj.getNDADocPath()); leadObj.setReqId(rfqObj.getReqId()); leadObj.setRFQName(rfqObj.getRFQName()); leadObj.setRFQProdServQntyList(rfqObj.getRFQProdServQntyList()); leadObj.setSubmitDate(rfqObj.getSubmitDate()); leadObj.setTermsandConds(rfqObj.getTermsandConds()); leadObj.setCurrency(rfqObj.getCurrency()); leadObj.setLeadResp(leadRespObj); try { cL.createNewLead(leadObj, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), User.Identity.Name); Label_Status.Text = "Lead created successfully"; Label_Status.ForeColor = System.Drawing.Color.Green; Label_Status.Visible = true; DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_LEAD_GRID_DATA]; Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST]; //DateUtility dU = new DateUtility(); dt.Rows.Add(); int count = dt.Rows.Count - 1; dt.Rows[count]["RFQNo"] = leadObj.getRFQId(); dt.Rows[count]["RFQName"] = leadObj.getRFQName(); String alertRequired = "true"; for (int j = 0; j < leadRespQuoteList.Count; j++) { RFQResponseQuotes QuoteObj = (RFQResponseQuotes)leadRespQuoteList[j]; if (!QuoteObj.getQuote().Equals("0")) { alertRequired = "false"; break; } } DateUtility dU = new DateUtility(); dt.Rows[count]["Lead_Alert_Required"] = alertRequired; dt.Rows[count]["CustName"] = DropDownList_Contacts.SelectedItem.Text; dt.Rows[count]["CustId"] = leadObj.getEntityId(); dt.Rows[count]["curr"] = allCurrList.ContainsKey(leadObj.getCurrency()) ? allCurrList[leadObj.getCurrency()].getCurrencyName() : ""; dt.Rows[count]["Submit Date"] = leadObj.getSubmitDate(); dt.Rows[count]["Submit Date Ticks"] = Convert.ToDateTime(leadObj.getSubmitDate()).Ticks; dt.Rows[count]["Due Date"] = dU.getConvertedDateWoTime(leadObj.getDueDate()); dt.Rows[count]["Due Date Ticks"] = !dt.Rows[count]["Due Date"].Equals("") ? Convert.ToDateTime(leadObj.getDueDate()).Ticks : 0; dt.Rows[count]["Next Date"] = dU.getConvertedDateWoTime(TextBox_Fwp_Date.Text.Trim()); dt.Rows[count]["Next Date Ticks"] = (!dt.Rows[count]["Next Date"].Equals("") ? Convert.ToDateTime(TextBox_Fwp_Date.Text).Ticks : 0); dt.Rows[count]["Assgn To"] = (!DropDownList_Users.SelectedValue.Equals("") ? DropDownList_Users.SelectedValue : ""); dt.Rows[count]["ActiveStat"] = leadObj.getActiveStat(); dt.Rows[count]["Mode"] = leadObj.getCreateMode(); dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC"; Session[SessionFactory.ALL_SALE_ALL_LEAD_GRID_DATA] = dt.DefaultView.ToTable(); ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshLeadGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "Lead creation failed"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; } finally { Session.Remove(SessionFactory.CREATE_LEAD_SELECTED_RFQ_SPEC_MAP); Session.Remove(SessionFactory.CREATE_LEAD_RFQ_ID); Session.Remove(SessionFactory.CREATE_LEAD_PROD_SRV_QNTY_LIST); Session.Remove(SessionFactory.CREATE_LEAD_NDA_FILE); Session.Remove(SessionFactory.CREATE_LEAD_RESP_QUOTE_LIST); Session.Remove(SessionFactory.CREATE_LEAD_QUOTE_UNIT); } } }
protected void Button_Inv_Update_Click(object sender, EventArgs e) { String sectionTnC = Label_TNC_flag_Inv.Text; //The sectionTnC label helps to determinte whethere the sections need an insert or update Boolean insertFlag = sectionTnC.Equals("Y"); Boolean updateStat = true; ArrayList docFormatList = new ArrayList(); DocFormat sectionTnCObj = new DocFormat(); DocFormat sectionTaxCompObj = new DocFormat(); String docFormatId = ""; if (sectionTnC.Equals("Y")) { if (!TextBox_INV_format_name.Text.Equals("") && !TextBox_INV_TnC.Text.Equals("")) { docFormatId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING); sectionTnCObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); sectionTnCObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); sectionTnCObj.setDocformat_id(docFormatId); sectionTnCObj.setDocformat_name(TextBox_INV_format_name.Text); sectionTnCObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TNC); sectionTnCObj.setText(TextBox_INV_TnC.Text); docFormatList.Add(sectionTnCObj); } } else { Dictionary <String, String> whereCls = new Dictionary <string, string>(); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_CMP_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOC_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); whereCls.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_SECTION_TYPE, BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TNC); Dictionary <String, String> targetVals = new Dictionary <string, string>(); targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_TEXT, TextBox_INV_TnC.Text); targetVals.Add(BackEndObjects.DocFormat.DOCFORMAT_COL_DOCFORMAT_NAME, TextBox_INV_format_name.Text); BackEndObjects.DocFormat.updateDocFormatObjsDB(whereCls, targetVals, DBConn.Connections.OPERATION_UPDATE); updateStat = true; } try { Boolean refreshTaxCompGrid = false; if (!TextBox_Inv_Tax_Comp_Name.Text.Equals("") && !TextBox_Inv_Tax_Comp_Value.Text.Equals("")) { sectionTaxCompObj.setCmp_id(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); sectionTaxCompObj.setDoc_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE); docFormatId = docFormatId.Equals("") ? new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_DOCFORMAT_ID_STRING) : docFormatId; sectionTaxCompObj.setDocformat_id(docFormatId); sectionTaxCompObj.setDocformat_name(TextBox_INV_format_name.Text); sectionTaxCompObj.setSection_type(BackEndObjects.DocFormat.DOCFORMAT_DOC_TYPE_INVOICE_SECTION_TYPE_TAX); sectionTaxCompObj.setSectionTypeName(TextBox_Inv_Tax_Comp_Name.Text); sectionTaxCompObj.setText(TextBox_Inv_Tax_Comp_Value.Text); docFormatList.Add(sectionTaxCompObj); refreshTaxCompGrid = true; } if (docFormatList.Count > 0) { BackEndObjects.DocFormat.insertDocFormatDB(docFormatList); } if (refreshTaxCompGrid) { loadInvTaxCompGrid(); } Label_Inv_Update_stat.Visible = true; Label_Inv_Update_stat.ForeColor = System.Drawing.Color.Green; Label_Inv_Update_stat.Text = "Updated Successfully"; } catch (Exception ex) { Label_Inv_Update_stat.Visible = true; Label_Inv_Update_stat.ForeColor = System.Drawing.Color.Red; Label_Inv_Update_stat.Text = "Update Failed"; } }
/// <summary> /// Complete registration for the business entity /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { String shortRegstr = (Session[SessionFactory.SHORT_REGISTR_COMPLETE] != null ? Session[SessionFactory.SHORT_REGISTR_COMPLETE].ToString() : ""); bool shortRegstrCompl = ((shortRegstr != null && shortRegstr.Equals("true"))? true : false); ActionLibrary.RegistrationActions regstr = new ActionLibrary.RegistrationActions(); BackEndObjects.MainBusinessEntity mBE = new MainBusinessEntity(); mBE.setEntityName(TextBox5.Text); mBE.setEmailId(TextBox4.Text); mBE.setWebSite(TextBox7.Text); mBE.setIndChain(DropDownList1.SelectedValue.Trim()); mBE.setOwnerName(TextBox6.Text); mBE.setDesc(DropDownListDescr.SelectedValue); mBE.setPhNo(TextBox10.Text); String mBEId = ""; BackEndObjects.Id IdGen = new BackEndObjects.Id(); if (!shortRegstrCompl) { mBEId = IdGen.getNewId(Id.ID_TYPE_CMP_USR_STRING); } else { mBEId = (Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] != null ? Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString() : ""); } mBE.setEntityId(mBEId); int[] prodServ = ListBoxProdServc.GetSelectedIndices(); Dictionary <String, ProductCategory> prdDict = new Dictionary <string, BackEndObjects.ProductCategory>(); Dictionary <String, ProductCategory> prodCatMBE = MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(mBE.getEntityId()); for (int i = 0; i < prodServ.Length; i++) { ProductCategory ePd = new ProductCategory(); //Add products/service which are not already added for the Main business entity - this is to avoid error situation //when the user by mistake clicks twice in the submit button in the registration page if (!prodCatMBE.ContainsKey(ListBoxProdServc.Items[prodServ[i]].Value)) { ePd.setCategoryId(ListBoxProdServc.Items[prodServ[i]].Value); ePd.setProductCategoryName(ListBoxProdServc.Items[prodServ[i]].Text); prdDict.Add(ePd.getCategoryId(), ePd); } } mBE.setMainProductServices(prdDict); userDetails uD = new userDetails(); Boolean userIdAlreadyExistis = false; if (!shortRegstrCompl) { userDetails udTest = BackEndObjects.userDetails.getUserDetailsbyIdDB(TextBox1.Text); if (udTest.getUserId() == null || udTest.getUserId().Equals("")) //New user id { uD.setMainEntityId(mBEId); Random ranGen = new Random(); int saltInt = ranGen.Next(1, 16); byte[] plainTextBytes = System.Text.Encoding.UTF8.GetBytes((TextBox2.Text.Equals("") ? TextBox2.Attributes["password"] : TextBox2.Text) + saltInt); HashAlgorithm hashConverter = new SHA256Managed(); byte[] hashedByteStream = hashConverter.ComputeHash(plainTextBytes); String encryptedAndConvertedPassword = Convert.ToBase64String(hashedByteStream); uD.setPassword(encryptedAndConvertedPassword); uD.setUserId(TextBox1.Text); uD.setMainEntityId(mBE.getEntityId()); uD.setSalt(saltInt.ToString()); uD.setPrivilege(BackEndObjects.EntityAccessListRecord.ENTITY_ACCESS_LIST_RECORD_ACCESS_OWNER_ACCESS); } else { Label_UserId_Exists.Visible = true; Label_UserId_Exists.Text = "User Id not available.. please enter a different one"; userIdAlreadyExistis = true; } } AddressDetails aD = new AddressDetails(); AddressDetails aDTest = AddressDetails.getAddressforMainBusinessEntitybyIdDB(mBE.getEntityId()); //If Address detais for this main business entity is not already set up - this is to handle error situation. //when the user by mistake clicks twice in the submit button in the registration page //Because as of now, the backend only accepts one address detail for the main business entity if (aDTest.getLocalityId() == null || aDTest.getLocalityId().Equals("")) { aD.setAddrLine1(TextBox8.Text); aD.setLocalityId(DropDownList5.SelectedValue); aD.setBaseCurrencyId(DropDownListBaseCurr.SelectedValue); aD.setMainBusinessId(mBEId); aD.setSubEntityId(AddressDetails.DUMMY_CHAIN_ID); } //FileUpload fU = FileUpload1; //Removing the option of image upload in registration page BackEndObjects.Image imgObj = new BackEndObjects.Image(); /*if (fU != null && fU.HasFile) * { * imgObj.setImgId(IdGen.getNewId(Id.ID_TYPE_IMAGE_ID_STRING)); * imgObj.setEntityId(mBE.getEntityId()); * imgObj.setFileStream(fU); * imgObj.setImgPath(); * }*/ Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING] = mBEId; ArrayList regstObjs = new ArrayList(); if (mBE.getEntityId() != null && !mBE.getEntityId().Equals("")) { regstObjs.Add(mBE); } if (uD.getUserId() != null && !uD.getUserId().Equals("")) { regstObjs.Add(uD); } if (aD.getLocalityId() != null && !aD.getLocalityId().Equals("")) { regstObjs.Add(aD); } if (imgObj.getImgId() != null && !imgObj.getImgId().Equals("")) { regstObjs.Add(imgObj); } try { if (!userIdAlreadyExistis) { regstr.completeRegr(regstObjs); Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Green; Label_Status.Text = "Data inserted successfully"; Button_Register_Business.Enabled = false; Button_Register_Short.Enabled = false; } } catch (Exception ex) { Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Text = "Error entering details"; } HyperLink1.Visible = true; }
protected void createRfq() { if (DropDownList_Level1.SelectedValue.Equals("_")) { Label_Status.Text = "Please select one product category"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; Button_Submit_Req.Enabled = true; Button_Submit_Next.Enabled = true; Button_Submit_Extra_Prd_Srv.Enabled = true; } else { BackEndObjects.RFQDetails rfqObj = new BackEndObjects.RFQDetails(); BackEndObjects.Id idGen = new BackEndObjects.Id(); String rfqId = ""; if (Session[SessionFactory.CREATE_RFQ_RFQ_ID] == null) { rfqId = idGen.getNewId(BackEndObjects.Id.ID_TYPE_RFQ_STRING); Session[SessionFactory.CREATE_RFQ_RFQ_ID] = rfqId; //store the newly created RFQ id in the session } if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList rfqSpecObjList = (ArrayList)Session[SessionFactory.CREATE_RFQ_SELECTED_RFQ_SPEC_MAP]; //Set the RFQ id for all the spec objects if (rfqSpecObjList != null) { for (int i = 0; i < rfqSpecObjList.Count; i++) { ((BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]).setRFQId(rfqId); } } rfqObj.setRFQProdServList(rfqSpecObjList); rfqObj.setRFQId(rfqId); rfqObj.setCreatedUsr(User.Identity.Name); rfqObj.setActiveStat(BackEndObjects.RFQDetails.RFQ_ACTIVE_STAT_ACTIVE); rfqObj.setDueDate(TextBox_Within_Date.Text); rfqObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); rfqObj.setCreatedEntity(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); rfqObj.setCurrency(DropDownList_Curr.SelectedValue); // FileUpload1=(FileUpload1 == null ? (FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] : FileUpload1); if (FileUpload1 != null && FileUpload1.HasFile) { rfqObj.setFileStream(FileUpload1); rfqObj.setNDADocPathInFileStore(rfqObj.getEntityId()); } else if ((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE] != null && ((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE]).HasFile) { rfqObj.setFileStream((FileUpload)Session[SessionFactory.CREATE_RFQ_NDA_FILE]); rfqObj.setNDADocPathInFileStore(rfqObj.getEntityId()); } String localId = (!DropDownList_Locality.SelectedValue.Equals("_") && !DropDownList_Locality.SelectedValue.Equals("") ? DropDownList_Locality.SelectedValue : (!DropDownList_City.SelectedValue.Equals("_") && !DropDownList_City.SelectedValue.Equals("") ? DropDownList_City.SelectedValue : (!DropDownList_State.SelectedValue.Equals("_") && !DropDownList_State.SelectedValue.Equals("") ? DropDownList_State.SelectedValue : (!DropDownList_Country.SelectedValue.Equals("_") && !DropDownList_Country.SelectedValue.Equals("") ? DropDownList_Country.SelectedValue : "")))); rfqObj.setLocalityId(localId); rfqObj.setSubmitDate(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); rfqObj.setTermsandConds(TextBox_TnC.Text); rfqObj.setRFQName(TextBox_Reqr_Name.Text); rfqObj.setCreateMode(RFQDetails.CREATION_MODE_AUTO); //Set the approval Status int rfqLevel = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getRfqApprovalLevel(); BackEndObjects.Workflow_Action actionObj = null; if (rfqLevel > 0) { String reportingToUser = BackEndObjects.userDetails. getUserDetailsbyIdDB(User.Identity.Name, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()).getReportsTo(); rfqObj.setApprovalStat(reportingToUser); actionObj = new Workflow_Action(); actionObj.setEntId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); actionObj.setUserId(User.Identity.Name); actionObj.setActionTaken(BackEndObjects.Workflow_Action.WORKFLOW_ACTION_ACTION_TAKEN_SUBMITTED); actionObj.setActionDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); actionObj.setContextId(rfqObj.getRFQId()); actionObj.setContextName(BackEndObjects.Workflow_Action.WORKFLOW_ACTION_CONTEXT_NAME_RFQ); actionObj.setComment(""); } else { rfqObj.setApprovalStat(RFQDetails.RFQ_APPROVAL_STAT_APPROVED); } rfqObj.setApprovalLevel("0".ToString()); BackEndObjects.RFQProdServQnty rfqPrdQnty = new BackEndObjects.RFQProdServQnty(); rfqPrdQnty.setRFQId(rfqObj.getRFQId()); if (!TextBox_Price_Range_From.Text.Equals("")) { rfqPrdQnty.setFromPrice(TextBox_Price_Range_From.Text); } if (!TextBox_Price_Range_To.Text.Equals("")) { rfqPrdQnty.setToPrice(TextBox_Price_Range_To.Text); } if (!TextBox_Prod_Qnty_From.Text.Equals("")) { rfqPrdQnty.setFromQnty(float.Parse(TextBox_Prod_Qnty_From.Text)); } if (!TextBoxrod_Qnty_To.Text.Equals("")) { rfqPrdQnty.setToQnty(float.Parse(TextBoxrod_Qnty_To.Text)); } rfqPrdQnty.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); rfqPrdQnty.setProdCatId(Session[SessionFactory.CREATE_RFQ_SELECTED_PRODUCT_CAT].ToString()); //ArrayList rfqPrdQntyList = new ArrayList(); //rfqPrdQntyList.Add(rfqPrdQnty); ArrayList prodSrvQntyList = (ArrayList)Session[SessionFactory.CREATE_RFQ_PROD_SRV_QNTY_LIST]; if (prodSrvQntyList == null) { prodSrvQntyList = new ArrayList(); } prodSrvQntyList.Add(rfqPrdQnty); //Ensure that all objects in the arraylist has an associated rfqid for (int i = 0; i < prodSrvQntyList.Count; i++) { BackEndObjects.RFQProdServQnty temp = (RFQProdServQnty)prodSrvQntyList[i]; if (temp.getRFQId() == null || temp.getRFQId().Equals("")) { temp.setRFQId(rfqObj.getRFQId()); } } rfqObj.setRFQProdServQntyList(prodSrvQntyList); Dictionary <String, String> reqSpecUniqnessValidation = new Dictionary <string, string>(); if (rfqSpecObjList != null) { for (int i = 0; i < rfqSpecObjList.Count; i++) { BackEndObjects.RFQProductServiceDetails rfqSpecObj = (BackEndObjects.RFQProductServiceDetails)rfqSpecObjList[i]; if (reqSpecUniqnessValidation.ContainsKey(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId())) { rfqSpecObjList.RemoveAt(i);//Remove the current RFQ spec object from the list - otherwise it will cause exception at DB layer while inserting } else { reqSpecUniqnessValidation.Add(rfqSpecObj.getPrdCatId() + ":" + rfqSpecObj.getFeatId(), ""); if (rfqSpecObj.getFileStream() != null) { rfqSpecObj.setImgPathInFileStore(rfqObj.getEntityId()); } } } } ActionLibrary.PurchaseActions._createRFQ cR = new ActionLibrary.PurchaseActions._createRFQ(); try { cR.createNewRFQ(rfqObj); if (actionObj != null) { BackEndObjects.Workflow_Action.insertWorkflowActionObject(actionObj); } Label_Status.Text = "RFQ created successfully....You MUST broadcast an RFQ for vendors to see!" + (rfqLevel == 0 ? " RFQ will be auto approved as there is no approval rule set in Administration->WorkflowMgmt->RFQ" : ""); Label_Status.ForeColor = System.Drawing.Color.Green; Label_Status.Visible = true; //Refresh the parent grid DataTable dt = (DataTable)Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_GRID_DATA]; Dictionary <String, Currency> allCurrList = (Dictionary <String, Currency>)Session[SessionFactory.CURRENCY_LIST]; dt.Rows.Add(); int i = dt.Rows.Count - 1; String docName = ""; if (rfqObj.getNDADocPath() != null) { String[] docPathList = rfqObj.getNDADocPath(). Split(new String[] { "\\" }, StringSplitOptions.RemoveEmptyEntries); if (docPathList.Length > 0) { docName = docPathList[docPathList.Length - 1]; } } DateUtility dU = new DateUtility(); dt.Rows[i]["RFQNo"] = rfqObj.getRFQId(); dt.Rows[i]["RFQName"] = rfqObj.getRFQName(); dt.Rows[i]["Submit Date"] = rfqObj.getSubmitDate(); dt.Rows[i]["curr"] = allCurrList.ContainsKey(rfqObj.getCurrency()) ? allCurrList[rfqObj.getCurrency()].getCurrencyName() : ""; dt.Rows[i]["Submit Date Ticks"] = Convert.ToDateTime(rfqObj.getSubmitDate()).Ticks; dt.Rows[i]["Due Date"] = dU.getConvertedDateWoTime(rfqObj.getDueDate()); dt.Rows[i]["Due Date Ticks"] = !dt.Rows[i]["Due Date"].Equals("")?Convert.ToDateTime(dt.Rows[i]["Due Date"]).Ticks:0; dt.Rows[i]["ApprovalStat"] = rfqObj.getApprovalStat(); dt.Rows[i]["Po_No"] = "N/A"; dt.Rows[i]["Hidden_Doc_Name"] = (docName == null || docName.Equals("") ? "" : docName); dt.Rows[i]["ActiveStatus"] = rfqObj.getActiveStat(); dt.Rows[i]["Inv_No"] = "N/A"; dt.DefaultView.Sort = "Submit Date Ticks" + " " + "DESC"; Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_GRID_DATA] = dt.DefaultView.ToTable(); ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshRefqGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "RFQ creation failed"; Label_Status.ForeColor = System.Drawing.Color.Red; Label_Status.Visible = true; } finally { Session.Remove(SessionFactory.CREATE_RFQ_SELECTED_RFQ_SPEC_MAP); Session.Remove(SessionFactory.CREATE_RFQ_RFQ_ID); Session.Remove(SessionFactory.CREATE_RFQ_PROD_SRV_QNTY_LIST); Session.Remove(SessionFactory.CREATE_RFQ_NDA_FILE); } } }
protected void Button_Create_Req_Click(object sender, EventArgs e) { BackEndObjects.PurchaseOrder POObj = new BackEndObjects.PurchaseOrder(); String context = Request.QueryString.GetValues("context")[0]; String poId = new BackEndObjects.Id().getNewId(BackEndObjects.Id.ID_TYPE_PO_ID_STRING); POObj.setDate_created(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); POObj.setPo_id(poId); POObj.setPo_ship_via(TextBox_Ship_Via.Text); POObj.setPo_tnc(TextBox_TnC.Text); POObj.setRfq_id(Request.QueryString.GetValues("rfqId")[0]); POObj.setTotal_tax_rate((!TextBox_tax.Text.Equals("")?TextBox_tax.Text:"0")); POObj.setCurrency(DropDownList_Curr.SelectedValue); if (context.Equals("client")) { POObj.setRespEntId(Request.QueryString.GetValues("respCompId")[0]); } else { POObj.setRespEntId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); } ArrayList POQuoteObjList = new ArrayList(); foreach (GridViewRow gVR in GridView1.Rows) { BackEndObjects.PurchaseOrderQuote POQuoteObj = new BackEndObjects.PurchaseOrderQuote(); POQuoteObj.setPo_id(poId); POQuoteObj.setProd_srv_category(((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text); POQuoteObj.setProduct_name(((Label)gVR.Cells[0].FindControl("Label_Product_Name")).Text); POQuoteObj.setQuote(float.Parse(((TextBox)gVR.Cells[0].FindControl("TextBox_Unit_Price")).Text)); POQuoteObj.setUnits(float.Parse(((TextBox)gVR.Cells[0].FindControl("TextBox_Qnty")).Text)); POQuoteObjList.Add(POQuoteObj); } try { BackEndObjects.PurchaseOrder.insertPurchaseOrderDB(POObj); BackEndObjects.PurchaseOrderQuote.insertPurchaseOrderQuoteListDB(POQuoteObjList); Label_PO_No.Visible = true; Label_PO_No.Text = poId; Label_PO_Creation_Stat.Visible = true; Label_PO_Creation_Stat.ForeColor = System.Drawing.Color.Green; if (context.Equals("client")) { Label_PO_Creation_Stat.Text = "Purchase Order Created Successfully"; } else { Label_PO_Creation_Stat.Text = "Sales Order Created Successfully"; } String dataItemIndex = Request.QueryString.GetValues("dataItemIndex") != null?Request.QueryString.GetValues("dataItemIndex")[0] : ""; if (!dataItemIndex.Equals("")) { DataTable dt = (DataTable)Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_GRID_DATA]; dt.Rows[Int32.Parse(dataItemIndex)]["PO_Id"] = POObj.getPo_id(); Session[SessionFactory.ALL_SALE_ALL_POTENTIAL_GRID_DATA] = dt; ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshPotnGrid", "RefreshParent();", true); } Button_Create_PO.Enabled = false; } catch (Exception ex) { Label_PO_Creation_Stat.Visible = true; Label_PO_Creation_Stat.ForeColor = System.Drawing.Color.Red; if (context.Equals("client")) { Label_PO_Creation_Stat.Text = "Purchase Order Creation Failed"; } else { Label_PO_Creation_Stat.Text = "Sales Order Creation Failed"; } } }