protected void populateEntityDetails() { MainBusinessEntity mBEObj = BackEndObjects.MainBusinessEntity. getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); loadProdServList(MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(mBEObj.getEntityId())); TextBox_Name.Text = mBEObj.getEntityName(); TextBox_Contact.Text = mBEObj.getPhNo(); TextBox_Email.Text = mBEObj.getEmailId(); TextBox_Owner_Name.Text = mBEObj.getOwnerName(); TextBox_Site.Text = mBEObj.getWebSite(); Dictionary <String, businessDescription> busDescDict = BackEndObjects.businessDescription.getAllBusinessDescriptionDB(); foreach (KeyValuePair <String, businessDescription> kvp in busDescDict) { ListItem lt = new ListItem(); lt.Text = ((businessDescription)kvp.Value).getDescName(); lt.Value = ((businessDescription)kvp.Value).getDescId(); DropDownList_Business_Desc.Items.Add(lt); if (((businessDescription)kvp.Value).getDescId().Equals(mBEObj.getDesc())) { DropDownList_Business_Desc.SelectedValue = lt.Value; } } }
protected void loadSLAandAlertDetails() { MainBusinessEntity mBEObj = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); TextBox_Alert_Email.Text = mBEObj.getSupportEmail(); TextBox_New_Defect_Email.Text = mBEObj.getNewSREmailBody(); TextBox_Resolved_Defect_Email.Text = mBEObj.getResolvedSRBody(); ArrayList slaList = DefectSLA.getDefectSLADetailsbyentIdDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), DefectSLA.DEFECT_TYPE_SERVICE_REQUEST); if (slaList != null && slaList.Count > 0) { DataTable dt = new DataTable(); dt.Columns.Add("Hidden_Type"); dt.Columns.Add("sev"); dt.Columns.Add("sla"); dt.Columns.Add("alertBefore"); for (int i = 0; i < slaList.Count; i++) { DefectSLA slaObj = (DefectSLA)slaList[i]; dt.Rows.Add(); dt.Rows[i]["Hidden_Type"] = slaObj.getContext_Type(); dt.Rows[i]["sev"] = slaObj.getSeverity(); dt.Rows[i]["sla"] = slaObj.getSLA(); dt.Rows[i]["alertBefore"] = slaObj.getAlert_Before(); } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; ViewState["WorkflowDefectSLA" + Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()] = dt; } }
/// <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 Create_Chain_User_Click(object sender, EventArgs e) { userDetails udTest = BackEndObjects.userDetails.getUserDetailsbyIdDB(TextBox1.Text); if (udTest.getUserId() == null || udTest.getUserId().Equals("")) //New user id { userDetails uD = new userDetails(); uD.setMainEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); 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.setSubEntityId(DropDownList1.SelectedValue); uD.setUserId(TextBox1.Text); uD.setPassword(encryptedAndConvertedPassword); uD.setSalt(saltInt.ToString()); uD.setName(TextBox_User_Name_NewAccount.Text); Dictionary <String, userDetails> userList = MainBusinessEntity.getUserDetailsforMainEntitybyIdDB(uD.getMainEntityId()); if (userList.ContainsKey(uD.getUserId())) { Label2.Visible = true; Label2.ForeColor = System.Drawing.Color.Red; Label2.Text = "This user account is already created for your organization"; } else { ArrayList uDChains = new ArrayList(); uDChains.Add(uD); ActionLibrary.RegistrationActions regstr = new RegistrationActions(); try { regstr.completeRegr(uDChains); Label2.Visible = true; Label2.ForeColor = System.Drawing.Color.Green; Label2.Text = "Account created successfully"; } catch (Exception ex) { Label2.Visible = true; Label2.ForeColor = System.Drawing.Color.Red; Label2.Text = "Account creation failed"; } } } else { Label2.Visible = true; Label2.ForeColor = System.Drawing.Color.Red; Label2.Text = "User Id is not available..please choose another one"; } }
protected void fillRespQuoteGrid() { DataTable dt = new DataTable(); dt.Columns.Add("RespCompId"); dt.Columns.Add("VendName"); dt.Columns.Add("quote"); dt.Columns.Add("NDA"); dt.Columns.Add("DateVal"); dt.Columns.Add("comm"); dt.Columns.Add("ShortListed"); int counter = 0; Dictionary <String, RFQResponse> respDict = RFQResponse.getAllRFQResponseforRFQIdDB(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); DateUtility dU = new DateUtility(); foreach (KeyValuePair <String, RFQResponse> kvp in respDict) { RFQResponse respObj = (RFQResponse)kvp.Value; dt.Rows.Add(); dt.Rows[counter]["RespCompId"] = respObj.getRespEntityId(); dt.Rows[counter]["VendName"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(respObj.getRespEntityId()).getEntityName(); dt.Rows[counter]["DateVal"] = dU.getConvertedDate(respObj.getRespDate()); BackEndObjects.RFQShortlisted shortObj = BackEndObjects.RFQShortlisted. getRFQShortlistedbyRespEntandRFQId(respObj.getRespEntityId(), Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); if (shortObj != null && shortObj.getRFQId() != null && !shortObj.getRFQId().Equals("")) { dt.Rows[counter]["ShortListed"] = "Y"; } else { dt.Rows[counter]["ShortListed"] = "N"; } counter++; } GridView_RFQ_Resp_Quotes.DataSource = dt; GridView_RFQ_Resp_Quotes.DataBind(); GridView_RFQ_Resp_Quotes.Columns[1].Visible = false; if (dt == null || dt.Rows.Count == 0) { Label_Empty_Quote.Visible = true; } else { Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_ALL_QUOTES_GRID] = dt; } }
protected void Button_Refresh_Click(object sender, EventArgs e) { //fillContactGrid(); String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); foreach (GridViewRow gVR in GridView1.Rows) { if (((Label)gVR.Cells[0].FindControl("Label_From_Site")).Text.Equals("Y")) { //Refresh the contacts which are taken from the site String contactEntId = ((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text; Dictionary <String, String> whereCls = new Dictionary <string, string>(); whereCls.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_CONTACT_ENTITY_ID, contactEntId); whereCls.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_ENTITY_ID, entId); MainBusinessEntity mBEObj = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(contactEntId); AddressDetails addrObj = AddressDetails.getAddressforMainBusinessEntitybyIdDB(mBEObj.getEntityId()); Dictionary <String, ProductCategory> mainProdList = MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(contactEntId); String prodList = ""; foreach (KeyValuePair <String, ProductCategory> kvp in mainProdList) { prodList += kvp.Value.getCategoryId() + ","; } if (prodList.Length > 0) { prodList = prodList.TrimEnd(','); } Dictionary <String, String> targetVals = new Dictionary <string, string>(); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_EMAIL_ID, mBEObj.getEmailId()); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_MOB_NO, mBEObj.getPhNo()); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_CONTACT_NAME, mBEObj.getEntityName()); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_LOCALITY_ID, addrObj.getLocalityId()); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_STREET_NAME, addrObj.getAddrLine1()); targetVals.Add(BackEndObjects.Contacts.CONTACT_TABLE_COL_PROD_LIST, prodList); BackEndObjects.Contacts.updateContactDetailsDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE); } fillContactGrid(); } Button_Audit_Contact.Enabled = false; Button_Notes_Contact.Enabled = false; GridView1.SelectedIndex = -1; }
protected void fillRespQuoteGrid() { DataTable dt = new DataTable(); dt.Columns.Add("RespCompId"); dt.Columns.Add("VendName"); dt.Columns.Add("quote"); dt.Columns.Add("NDA"); dt.Columns.Add("DateVal"); dt.Columns.Add("comm"); dt.Columns.Add("TotalAmnt"); dt.Columns.Add("DealReq"); ArrayList shortListedList = RFQShortlisted. getAllShortListedEntriesbyRFQId(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); DateUtility dU = new DateUtility(); for (int i = 0; i < shortListedList.Count; i++) { RFQShortlisted shortObj = (RFQShortlisted)shortListedList[i]; dt.Rows.Add(); dt.Rows[i]["RespCompId"] = shortObj.getRespEntityId(); dt.Rows[i]["VendName"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(shortObj.getRespEntityId()).getEntityName(); dt.Rows[i]["DateVal"] = dU.getConvertedDate(shortObj.getCreatedDate()); dt.Rows[i]["TotalAmnt"] = shortObj.getPotenAmnt(); dt.Rows[i]["DealReq"] = shortObj.getFinlSupFlag(); } GridView_RFQ_Resp_Quotes.DataSource = dt; GridView_RFQ_Resp_Quotes.DataBind(); GridView_RFQ_Resp_Quotes.Columns[1].Visible = false; //Find out the selected entity if any RFQShortlisted selectedPotObj = RFQShortlisted. getRFQShortlistedEntryforFinalizedVendor(Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SELECTED_RFQ_ID].ToString()); Session[SessionFactory.ALL_PURCHASE_ALL_RFQ_SHORLISTED_FINALIZED_POTEN] = selectedPotObj.getPotentialId(); foreach (GridViewRow gVR in GridView_RFQ_Resp_Quotes.Rows) { if (((Label)gVR.Cells[0].FindControl("Label_Hidden")).Text.Equals(selectedPotObj.getRespEntityId())) { ((System.Web.UI.WebControls.Image)gVR.Cells[0].FindControl("Image_Selected")).Visible = true; } } }
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { BackEndObjects.Contacts contactObj = new BackEndObjects.Contacts(); Panel_Create_Contact.Enabled = false; Label_Disable.Visible = true; contactObj.setContactEntityId(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Contact_Ent_Id")).Text); //contactObj.setContactName(((Label)GridView1.SelectedRow.Cells[1].FindControl("Label_Name")).Text); //contactObj.setEmailID(((Label)GridView1.SelectedRow.Cells[1].FindControl("Label_Email")).Text); contactObj.setContactName(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Name")).Text); contactObj.setEmailID(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Email_Id")).Text); contactObj.setEntityId(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); contactObj.setFromSite("Y"); //if (Session[SessionFactory.CREATE_CONTACT_LOCALITY_ID]!=null) if (((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Local_Id")).Text != null) { contactObj.setLocalityId(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Local_Id")).Text); } contactObj.setMobNo(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Contact_No")).Text); if (((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Street_Name")).Text != null) { contactObj.setStreetName(((Label)GridView1.SelectedRow.Cells[0].FindControl("Label_Street_Name")).Text); } String prodList = ""; //Get the product/service details Dictionary <String, ProductCategory> prodDict = MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(contactObj.getContactEntityId()); foreach (KeyValuePair <String, ProductCategory> kvp in prodDict) { prodList += kvp.Value.getCategoryId() + ","; } if (prodList.Length > 0) { prodList = prodList.TrimEnd(','); } contactObj.setProdList(prodList); Session[SessionFactory.CREATE_CONTACT_CONTACT_OBJ] = contactObj; }
protected void trySendEmail(String defId, String entId) { MainBusinessEntity mBEObj = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); Dictionary <String, String> contactEmailList = (Dictionary <String, String>)ViewState["createDefectContactEmailList"]; if (mBEObj.getSupportEmail() != null && !mBEObj.getSupportEmail().Equals("") && contactEmailList != null) { try { ActionLibrary.Emails.sendEmail( mBEObj.getSupportEmail(), mBEObj.getSupportEmailPass(), contactEmailList[entId], "Defect Logged with defect id#" + defId, mBEObj.getNewSupportEmailBody()); } catch (Exception ex) { } } }
protected void populateCategoryDropDown() { String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); Dictionary <String, ProductCategory> catDict = MainBusinessEntity.getProductDetailsforMainEntitybyIdDB(entId); ListItem firstVal = new ListItem(); firstVal.Text = "_"; firstVal.Value = "_"; DropDownList_Category.Items.Add(firstVal); foreach (KeyValuePair <String, ProductCategory> kvp in catDict) { ListItem lt = new ListItem(); lt.Text = ((ProductCategory)kvp.Value).getProductCategoryName(); lt.Value = kvp.Key; DropDownList_Category.Items.Add(lt); } DropDownList_Category.SelectedValue = "_"; }
protected void fillGrid() { String[] contextId = Request.QueryString.GetValues("context"); String[] sourceEnt = Request.QueryString.GetValues("source"); String[] destEnt = Request.QueryString.GetValues("destination"); SortedDictionary <DateTime, BackEndObjects.Communications> allComm = BackEndObjects.Communications. getAllCommunicationsforContextIdBetweenSourceAndDestDB(contextId[0], sourceEnt[0], destEnt[0]); DataTable dt = new DataTable(); dt.Columns.Add("HiddenComm"); dt.Columns.Add("RespDateTime"); dt.Columns.Add("FromUsr"); dt.Columns.Add("FromComp"); dt.Columns.Add("Comments"); int counter = 0; foreach (KeyValuePair <DateTime, BackEndObjects.Communications> kvp in allComm) { BackEndObjects.Communications commObj = kvp.Value; dt.Rows.Add(); dt.Rows[counter]["HiddenComm"] = commObj.getCommId(); dt.Rows[counter]["RespDateTime"] = commObj.getDateCreated(); dt.Rows[counter]["FromUsr"] = commObj.getFromUserId(); dt.Rows[counter]["FromComp"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(commObj.getFromEntityId()).getEntityName(); dt.Rows[counter]["Comments"] = commObj.getText(); counter++; } if (dt.Rows.Count > 0) { GridView_RFQ_Resp_Quotes_Comm.DataSource = dt; GridView_RFQ_Resp_Quotes_Comm.DataBind(); GridView_RFQ_Resp_Quotes_Comm.Visible = true; GridView_RFQ_Resp_Quotes_Comm.Columns[0].Visible = false; } }
protected void Button_Resolved_Email_Body_Click(object sender, EventArgs e) { Dictionary <String, String> whereCls = new Dictionary <string, string>(); Dictionary <String, String> targetVals = new Dictionary <string, string>(); whereCls.Add(MainBusinessEntity.MAIN_BUSINESS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); targetVals.Add(MainBusinessEntity.MAIN_BUSINESS_COL_SR_RESOLVED_BODY, TextBox_Resolved_Defect_Email.Text.Trim()); try { MainBusinessEntity.updateMainBusinessEntityWOimg_prd_user_subDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE); Label_Email_Stat.Visible = true; Label_Email_Stat.Text = "Email details updated successfully"; Label_Email_Stat.ForeColor = System.Drawing.Color.Green; } catch (Exception ex) { Label_Email_Stat.Visible = true; Label_Email_Stat.Text = "Email details update failed"; Label_Email_Stat.ForeColor = System.Drawing.Color.Red; } }
/// <summary> /// Populate the sub business entity drop down list /// </summary> protected void loadSubBusinessEntity() { String mbBEId = null; try { mbBEId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); } catch (Exception ex) { } if (mbBEId != null) { Dictionary <String, subBusinessEntity> subList = MainBusinessEntity.getSubEntitiesforMainEntitybyIdDB(mbBEId); foreach (KeyValuePair <String, subBusinessEntity> kvp in subList) { ListItem ltSub = new ListItem(); ltSub.Text = ((subBusinessEntity)kvp.Value).getSubEntityName(); ltSub.Value = kvp.Key.ToString(); DropDownList1.Items.Add(ltSub); } DropDownList1.SelectedIndex = 0; } }
protected void Button_Add_Email_Click(object sender, EventArgs e) { Dictionary <String, String> whereCls = new Dictionary <String, String>(); Dictionary <String, String> targetVals = new Dictionary <string, string>(); whereCls.Add(MainBusinessEntity.MAIN_BUSINESS_COL_BUSINESS_ID, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); targetVals.Add(MainBusinessEntity.MAIN_BUSINESS_COL_SUPPORT_EMAIL, TextBox_Alert_Email.Text); targetVals.Add(MainBusinessEntity.MAIN_BUSINESS_COL_SUPPORT_PASS, TextBox_Alert_Pass.Text); try { MainBusinessEntity.updateMainBusinessEntityWOimg_prd_user_subDB(targetVals, whereCls, DBConn.Connections.OPERATION_UPDATE); Label_Email_Stat.Text = "Support email details updated successfully. This email id will be used to send auto alerts to clients"; Label_Email_Stat.ForeColor = System.Drawing.Color.Green; Label_Email_Stat.Visible = true; } catch (Exception ex) { Label_Email_Stat.Text = "Update Failed"; Label_Email_Stat.ForeColor = System.Drawing.Color.Red; Label_Email_Stat.Visible = true; } }
/// <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 fillGrid(String contextId1, String contextId2, String contextId3, String contextTable) { ArrayList contextIdList = new ArrayList(); if (contextId1 != null && !contextId1.Equals("")) { contextIdList.Add(contextId1); } if (contextId2 != null && !contextId2.Equals("")) { contextIdList.Add(contextId2); } if (contextId3 != null && !contextId3.Equals("")) { contextIdList.Add(contextId3); } ArrayList auditDataList = BackEndObjects.AuditData.getAuditRecordsForContextIdsDB(contextIdList, contextTable); Dictionary <String, Dictionary <String, AuditFieldMapping> > mappingDict = (Dictionary <String, Dictionary <String, AuditFieldMapping> >) Cache["AllAuditFieldMapping"]; DataTable dt = new DataTable(); dt.Columns.Add("FieldName"); dt.Columns.Add("FieldValue"); dt.Columns.Add("ChangeTime"); dt.Columns.Add("ChangedUser"); dt.Columns.Add("ChangdOrg"); String entId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); String orgName = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(entId).getEntityName(); for (int i = 0; i < auditDataList.Count; i++) { dt.Rows.Add(); BackEndObjects.AuditData auditDataObj = (BackEndObjects.AuditData)auditDataList[i]; Dictionary <String, AuditFieldMapping> tableSpecificMappingDict = null; if (mappingDict.ContainsKey(auditDataObj.getTable_name())) { tableSpecificMappingDict = mappingDict[auditDataObj.getTable_name()]; } if (tableSpecificMappingDict != null && tableSpecificMappingDict.ContainsKey(auditDataObj.getField_name())) { if (tableSpecificMappingDict[auditDataObj.getField_name()].getField_visible().Equals("Y")) { dt.Rows[i]["FieldName"] = tableSpecificMappingDict[auditDataObj.getField_name()].getField_display_name(); } else { continue; } } else { dt.Rows[i]["FieldName"] = auditDataObj.getField_name(); }; dt.Rows[i]["FieldValue"] = auditDataObj.getField_value(); dt.Rows[i]["ChangeTime"] = auditDataObj.getChange_date_time(); dt.Rows[i]["ChangedUser"] = auditDataObj.getChnaged_by_user(); if (!entId.Equals(auditDataObj.getChanged_by_cmp())) { dt.Rows[i]["ChangdOrg"] = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(auditDataObj.getChanged_by_cmp()).getEntityName(); } else { dt.Rows[i]["ChangdOrg"] = orgName; } } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; }
/// <summary> /// Returns the existing transaction number list /// </summary> /// <returns></returns> protected Dictionary <String, String> fillPmntGrid() { DataTable dt = new DataTable(); dt.Columns.Add("Pmnt_Id"); dt.Columns.Add("Tran_No"); dt.Columns.Add("Pmnt_Type"); dt.Columns.Add("Amount"); dt.Columns.Add("Clearing_Stat"); dt.Columns.Add("Clearing_Stat_Note"); dt.Columns.Add("Pmnt_Date"); dt.Columns.Add("updatedBy"); String invId = Request.QueryString.GetValues("invId")[0]; Dictionary <String, Payment> pmntDict = BackEndObjects.Payment.getPaymentDetailsforInvoiceDB(invId); Dictionary <String, String> tranDict = new Dictionary <String, String>(); DateUtility dU = new DateUtility(); int counter = 0; float totalPmnt = 0; float totalCleared = 0; float totalUnCleared = 0; foreach (KeyValuePair <String, Payment> kvp in pmntDict) { dt.Rows.Add(); Payment pmntObj = kvp.Value; dt.Rows[counter]["Pmnt_Id"] = pmntObj.getPaymentId(); dt.Rows[counter]["Tran_No"] = pmntObj.getTranNo(); dt.Rows[counter]["Pmnt_Type"] = pmntObj.getPaymentType(); dt.Rows[counter]["Amount"] = pmntObj.getAmount(); dt.Rows[counter]["Clearing_Stat"] = pmntObj.getClearingStat(); dt.Rows[counter]["Clearing_Stat_Note"] = pmntObj.getClearingStatNote(); dt.Rows[counter]["Pmnt_Date"] = dU.getConvertedDate(pmntObj.getPmntDate()); String enttId = pmntObj.getEntityid(); String entName = ""; entName = BackEndObjects.Contacts.getContactDetailsforContactEntityDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), enttId).getContactName(); if (entName == null || entName.Equals("")) { entName = MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(enttId).getEntityName(); } dt.Rows[counter]["updatedBy"] = entName; totalPmnt += pmntObj.getAmount(); totalCleared = pmntObj.getClearingStat().Equals(BackEndObjects.Payment.PAYMENT_CLEARING_STAT_CLEAR) ? totalCleared + pmntObj.getAmount() : totalCleared; totalUnCleared = pmntObj.getClearingStat().Equals(BackEndObjects.Payment.PAYMENT_CLEARING_STAT_PENDING) ? totalUnCleared + pmntObj.getAmount() : totalUnCleared; if (!tranDict.ContainsKey(pmntObj.getTranNo())) { tranDict.Add(pmntObj.getTranNo(), pmntObj.getTranNo()); } counter++; } dt.DefaultView.Sort = "Pmnt_Date" + " " + "DESC"; GridView_Invoice_Pmnt.Visible = true; GridView_Invoice_Pmnt.DataSource = dt.DefaultView.ToTable(); GridView_Invoice_Pmnt.DataBind(); GridView_Invoice_Pmnt.Columns[2].Visible = false; Session[SessionFactory.ALL_INVOICE_PAYMENT_GRID] = dt; Label_Total_Pmnt_Made.Text = totalPmnt.ToString(); Label_Total_Cleared.Text = totalCleared.ToString(); Label_Total_Cleared.ForeColor = System.Drawing.Color.Green; Label_Total_Uncleared.Text = totalUnCleared.ToString(); Label_Total_Uncleared.ForeColor = System.Drawing.Color.Red; return(tranDict); }
protected void createNewProduct() { Dictionary <String, String> allExistingProdDict = (Dictionary <String, String>)Session[SessionFactory.ALL_PRODUCT_CREATE_PRODUCT_EXISTING_NAMES]; if (allExistingProdDict.ContainsKey(TextBox_Prod_Name.Text.Trim())) { Label_Status.Text = "Product Name Already Exists"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } else if (Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT] == null || Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString().Equals("")) { Label_Status.Text = "Must select one product category"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } else { if (!TextBox_Spec.Text.Equals("")) { getAddintionalProdSrvList(); TextBox_Spec.Text = ""; } ArrayList prodSpecList = (ArrayList)Session[SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP]; Dictionary <String, String> rSpecUniqnessValidation = new Dictionary <string, string>(); String mainEntId = Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(); if (prodSpecList != null) { for (int i = 0; i < prodSpecList.Count; i++) { ShopChildProdsSpecs prodSpecObj = (ShopChildProdsSpecs)prodSpecList[i]; prodSpecObj.setProdName(TextBox_Prod_Name.Text); if (rSpecUniqnessValidation.ContainsKey(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId())) { prodSpecList.RemoveAt(i); } else { rSpecUniqnessValidation.Add(prodSpecObj.getEntityId() + ":" + prodSpecObj.getProdName() + ":" + prodSpecObj.getFeatId(), prodSpecObj.getEntityId()); if (prodSpecObj != null && prodSpecObj.getFileStream() != null && prodSpecObj.getFileStream().HasFile) { prodSpecObj.setImgPathInFileStore(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); } } } } ShopChildProdsInventory childProdObj = new ShopChildProdsInventory(); childProdObj.setCreatedBy(User.Identity.Name); childProdObj.setDateCreated(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); childProdObj.setEntityId(mainEntId); childProdObj.setMsrmntUnit(DropDownList_Unit_Of_Msrmnt.SelectedValue); childProdObj.setProdCatId(Session[SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT].ToString()); childProdObj.setProdName(TextBox_Prod_Name.Text); childProdObj.setQnty((!TextBox_Stock.Text.Equals("")?float.Parse(TextBox_Stock.Text):0)); childProdObj.setUnitListPrice(TextBox_List_Price.Text); childProdObj.setUnitSrcPrice(TextBox_Src_Price.Text); childProdObj.setCurrency(DropDownList_Curr.SelectedValue); try { BackEndObjects.ShopChildProdsInventory.insertShopChildProdsInventoryDB(childProdObj); if (prodSpecList != null) { BackEndObjects.ShopChildProdsSpecs.insertShopChildProdsSpecsListDB(prodSpecList); } //Refresh the session variable with the newly added product name allExistingProdDict.Add(childProdObj.getProdName(), childProdObj.getProdName()); Session[SessionFactory.ALL_PRODUCT_CREATE_PRODUCT_EXISTING_NAMES] = allExistingProdDict; Dictionary <String, ProductCategory> existingProdDict = MainBusinessEntity. getProductDetailsforMainEntitybyIdDB(mainEntId); Label_Status.Text = "Product/Service Details Created Successfully"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Green; DropDownList_Level1.SelectedIndex = -1; DropDownList_Level2.SelectedIndex = -1; DropDownList_Level3.SelectedIndex = -1; if (!existingProdDict.ContainsKey(DropDownList_Level1.SelectedValue)) { ArrayList newMainProdCat = new ArrayList(); newMainProdCat.Add(DropDownList_Level1.SelectedValue); MainBusinessEntity.insertProductDetailsforEntityDB(mainEntId, newMainProdCat); Label_Status.Text += "...New Product category added to your product list"; } DataTable dt = (DataTable)Session[SessionFactory.ALL_PRODUCT_PROD_DATA_GRID]; dt.Rows.Add(); int count = dt.Rows.Count - 1; dt.Rows[count]["ProdCatId"] = childProdObj.getProdCatId(); dt.Rows[count]["ProdName"] = childProdObj.getProdName(); dt.Rows[count]["Stock"] = childProdObj.getQnty(); dt.Rows[count]["msrmnt"] = childProdObj.getMsrmntUnit(); dt.Rows[count]["srcPrice"] = childProdObj.getUnitSrcPrice(); dt.Rows[count]["listPrice"] = childProdObj.getUnitListPrice(); dt.Rows[count]["curr"] = DropDownList_Curr.SelectedItem.Text; Session[SessionFactory.ALL_PRODUCT_PROD_DATA_GRID] = dt; ScriptManager.RegisterStartupScript(this, typeof(string), "RefreshProdGrid", "RefreshParent();", true); } catch (Exception ex) { Label_Status.Text = "Product/Service Details Creation Failed"; Label_Status.Visible = true; Label_Status.ForeColor = System.Drawing.Color.Red; } finally { Session.Remove(SessionFactory.CREATE_PRODUCT_CHILD_PROD_SPEC_MAP); Session.Remove(SessionFactory.CREATE_PRODUCT_SELECTED_PRODUCT_CAT); } } }
protected void fillGrid() { ArrayList mBEList = BackEndObjects.MainBusinessEntity.getMainBusinessEntityListbyNameWithAddrDetailsDB(TextBox_Search_Contact.Text, Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString()); if (mBEList == null || mBEList.Count == 0) { Label_Status_Search.Visible = true; Label_Status_Search.ForeColor = System.Drawing.Color.Red; Label_Status_Search.Text = "No company found for the given id"; GridView1.Visible = false; } else { DataTable dt = new DataTable(); dt.Columns.Add("Name"); dt.Columns.Add("Country"); dt.Columns.Add("State"); dt.Columns.Add("City"); dt.Columns.Add("Locality"); dt.Columns.Add("Street Name"); dt.Columns.Add("Mob"); dt.Columns.Add("Email"); dt.Columns.Add("Contact Exists?"); dt.Columns.Add("localId"); dt.Columns.Add("ContactEntId"); for (int i = 0; i < mBEList.Count; i++) { //MainBusinessEntity mBEObj = BackEndObjects.MainBusinessEntity.getMainBusinessEntitybyIdwithLessDetailsDB(TextBox_Search_Contact.Text); MainBusinessEntity mBEObj = (MainBusinessEntity)mBEList[i]; AddressDetails mBEAddr = mBEObj.getAddressDetails(); Contacts contactObj = Contacts. getContactDetailsforContactEntityDB(Session[SessionFactory.MAIN_BUSINESS_ENTITY_ID_STRING].ToString(), mBEObj.getEntityId()); Label_Status_Search.Visible = false; BackEndObjects.Localities localObj = null; BackEndObjects.City cityObj = null; BackEndObjects.State stateObj = null; BackEndObjects.Country countryObj = null; if (mBEAddr.getLocalityId() != null && !mBEAddr.getLocalityId().Equals("")) { localObj = Localities.getLocalitybyIdDB(mBEAddr.getLocalityId()); cityObj = BackEndObjects.Localities.getCityDetailsforLocalitywoOtherAsscLocalitiesDB(mBEAddr.getLocalityId()); stateObj = BackEndObjects.City.getStateDetailsforCitywoOtherAsscCitiesDB(cityObj.getCityId()); countryObj = BackEndObjects.State.getCountryDetailsforStatewoOtherAsscStatesDB(stateObj.getStateId()); //Session[SessionFactory.CREATE_CONTACT_LOCALITY_ID] = localObj.getLocalityId(); //Session[SessionFactory.CREATE_CONTACT_ADDRESS_LINE1] = mBEAddr.getAddrLine1(); } dt.Rows.Add(); dt.Rows[i]["Name"] = mBEObj.getEntityName(); if (mBEAddr.getLocalityId() != null && !mBEAddr.getLocalityId().Equals("")) { dt.Rows[i]["Country"] = countryObj.getCountryName(); dt.Rows[i]["State"] = stateObj.getStateName(); dt.Rows[i]["City"] = cityObj.getCityName(); dt.Rows[i]["Locality"] = localObj.getLocalityName(); dt.Rows[i]["Street Name"] = mBEAddr.getAddrLine1(); dt.Rows[i]["localId"] = mBEAddr.getLocalityId(); dt.Rows[i]["ContactEntId"] = mBEAddr.getMainBusinessId(); } else { dt.Rows[i]["Country"] = "N/A"; dt.Rows[i]["State"] = "N/A"; dt.Rows[i]["City"] = "N/A"; dt.Rows[i]["Locality"] = "N/A"; dt.Rows[i]["Street Name"] = "N/A"; dt.Rows[i]["localId"] = ""; dt.Rows[i]["ContactEntId"] = mBEObj.getEntityId(); } dt.Rows[i]["Mob"] = mBEObj.getPhNo(); dt.Rows[i]["Email"] = mBEObj.getEmailId(); dt.Rows[i]["Contact Exists?"] = ((contactObj.getContactEntityId() != null && !contactObj.getContactEntityId().Equals("")) ? "Y" : "N"); } GridView1.DataSource = dt; GridView1.DataBind(); GridView1.Visible = true; GridView1.Columns[10].Visible = false; GridView1.Columns[11].Visible = false; Session[SessionFactory.CREATE_CONTACT_DATA_GRID] = dt; } }