protected void PerformMove(string CID, string acout) { SqlConnection LAconn = new SqlConnection(); var conn = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; LAconn.ConnectionString = conn; var comDal = new CompanyDAL(conn); var OwnerId = acout; String strSQLInsertStmt = "UPDATE dbo.Companies SET OwnershipAdminID = @OwnershipAdminID, AlteredDateTime=CURRENT_TIMESTAMP, OwnershipPeriod = NULL WHERE CompanyID =@CompanyID"; SqlCommand LAcmd = new SqlCommand(strSQLInsertStmt, LAconn); LAcmd.Parameters.AddWithValue("@OwnershipAdminID", OwnerId); LAcmd.Parameters.AddWithValue("@CompanyID", CID); try { LAconn.Open(); LAcmd.ExecuteNonQuery(); LAconn.Close(); } catch (Exception ex) { Console.Write(ex.Message.ToString()); } }
protected void performMove(String CID) { SqlConnection LAconn = new SqlConnection(); var conn = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; LAconn.ConnectionString = conn; var comDal = new CompanyDAL(conn); var OwnerId = comDal.CheckCompanyOwnerByID(CID); if (!string.IsNullOrEmpty(OwnerId)) { String strSQLInsertStmt = "UPDATE dbo.Companies SET OwnershipAdminID = @OwnershipAdminID, OwnershipPeriod = NULL WHERE CompanyID =@CompanyID"; SqlCommand LAcmd = new SqlCommand(strSQLInsertStmt, LAconn); LAcmd.Parameters.AddWithValue("@OwnershipAdminID", OwnerId); LAcmd.Parameters.AddWithValue("@CompanyID", CID); try { LAconn.Open(); LAcmd.ExecuteNonQuery(); LAconn.Close(); } catch (Exception ex) { Console.Write(ex.Message.ToString()); } } }
private static void AllocateCompanyToRep(List <ComReAssign> coms, string mode, string numberofaccoutns, string allocationPeriod, string allocrepId, string month, string year) { var repId = Convert.ToInt32(allocrepId); var listRecentAddedMoney = new List <DeltoneCRM_DAL.CompanyDAL.CompanyView>(); if (repId > 0) { var alloceCompanies = DoFilterForCompany(coms, mode, month, year); var numberAccount = Convert.ToInt32(numberofaccoutns); if (alloceCompanies.Count() < numberAccount) { numberAccount = alloceCompanies.Count(); } var allocTime = GetAllocationTime(allocationPeriod); var currentDate = DateTime.Now; var connn = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var comDal = new CompanyDAL(connn); for (var i = 0; i < numberAccount; i++) { var newHouseAccount = GetNewHouseCompany(alloceCompanies, repId); if (newHouseAccount != null) { listRecentAddedMoney.Add(newHouseAccount); comDal.InsertLead(newHouseAccount.CompanyID, repId, currentDate, allocTime); } } // Session["recentAddedCompany"] = listRecentAddedMoney; } }
private List <DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent> GetLeadEventList(int userId, string sear) { var eventsList = new List <DeltoneCRM_DAL.CalendarEventDAL.CalendarEvent>(); string cs = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var leadComList = new CompanyDAL(cs).GetLeadCompanyNOExpires(userId); var callBackEvents = new CalendarEventDAL(cs).GetAllCAllBackEvents(); callBackEvents = callBackEvents.OrderByDescending(x => x.start).ToList(); foreach (var com in leadComList) { var eve = (from cl in callBackEvents where cl.companyId == com.CompanyId select cl).ToList(); if (eve.Count > 0) { eventsList.Add(eve[0]); } } if (!string.IsNullOrEmpty(sear)) { eventsList = (from ec in eventsList where ec.description.Contains(sear) || ec.title.Contains(sear) select ec).ToList(); } return(eventsList); }
private DeltoneCRM_DAL.CompanyDAL.CompanyView GetNewCompaySel(List <DeltoneCRM_DAL.CompanyDAL.CompanyView> coViewAll, int repId) { string CONNSTRING = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var comDal = new CompanyDAL(CONNSTRING); var listCompanylead = comDal.GetLeadCompaniesNotExist(); Random rnd = new Random(); var currentDate = DateTime.Now; var pickedCom = coViewAll.OrderBy(x => rnd.Next()).Take(1).ToList(); if (pickedCom.Count > 0) { var pickedObj = pickedCom[0]; if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID && x.ExpiryDate.Date > currentDate.Date)) { return(GetNewCompaySel(coViewAll, repId)); } //else // if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID // && x.UserId == repId)) // { // return GetNewCompaySel(coViewAll, repId); // } else { return(pickedObj); } } return(null); }
protected void Page_Load(object sender, EventArgs e) { lblError.Text = string.Empty; lblMsg.Text = string.Empty; if (!IsPostBack) { CompanyDAL newCompanyDal = new CompanyDAL(); IList <Company> companies = newCompanyDal.GetAllCompany(); foreach (Company company in companies) { ListItem item = new ListItem(); item.Text = company.CompanyName; item.Value = company.CompanyRegID.ToString(); ddlCompany.Items.Add(item); } TAFDAL newTAF = new TAFDAL(); IList <TAFTemplate> templates = newTAF.GetAllTAFTemplates(); foreach (TAFTemplate template in templates) { ListItem item = new ListItem(); item.Text = template.TemplateName; item.Value = template.TemplateID.ToString(); ddlSelectTemplate.Items.Add(item); } } }
private static DeltoneCRM_DAL.CompanyDAL.CompanyView GetNewHouseCompany(List <DeltoneCRM_DAL.CompanyDAL.CompanyView> coViewAll, int repId) { var conn = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var comDal = new CompanyDAL(conn); var listCompanylead = comDal.GetLeadCompanies(); Random rnd = new Random(); var currentDate = DateTime.Now; var pickedCom = coViewAll.OrderBy(x => rnd.Next()).Take(1).ToList(); if (pickedCom.Count > 0) { var pickedObj = pickedCom[0]; if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID && x.ExpiryDate.Date > currentDate.Date)) { return(GetNewHouseCompany(coViewAll, repId)); } else if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID && x.UserId == repId)) { return(GetNewHouseCompany(coViewAll, repId)); } else { return(pickedObj); } } return(null); }
public CompanyDetailsEntities GetCompanyDetails() { ICompanyDAL compDetials = new CompanyDAL(); var companyDAL = compDetials.GetCompanyDetails(); return(companyDAL); }
private void ReadWriteCSVFile() { string date = System.DateTime.Now.ToString("ddMMyyhhmmss"); if (File.Exists(Server.MapPath(uppath))) { StreamReader sr = new StreamReader(Server.MapPath(uppath)); StreamWriter write = new StreamWriter(Server.MapPath(output)); CsvReader csvread = new CsvReader(sr); CsvWriter csw = new CsvWriter(write); IEnumerable <Company> record = csvread.GetRecords <Company>(); foreach (var rec in record) // Each record will be fetched and printed on the screen { csw.WriteRecord <Company>(rec); csw.NextRecord(); CompanyDAL compdal = new CompanyDAL(); compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString(); compdal.InsertCompany(rec); } sr.Close(); write.Close();//close file streams if (File.Exists(Server.MapPath(uppath))) { File.Delete(Server.MapPath(uppath)); } } }
public void AddNewMessagesCompanyIdTest() { CompanyDAL companyDAL = new CompanyDAL(); List <CompanyModel> companies = companyDAL.GetCompanies(); MessagesFromBulidingModel model = new MessagesFromBulidingModel(); model.Subject = "testSubject"; model.Text = "testText"; model.Companies = companies; MessageDAL messageDAL = new MessageDAL(); messageDAL.AddNewMessages(model); List <MessageToCompanyModel> messages = messageDAL.GetMessagesFromBuilding(); int counter = 0; foreach (var item in companies) { if (messages.Where(x => x.Subject == "testSubject" && x.CompanyId == item.Id).FirstOrDefault() != null) { counter++; } } Assert.That(counter == companies.Count, Is.True); }
private void AddAccount(List <DeltoneCRM_DAL.CompanyDAL.CompanyView> coViewAll) { var repId = Convert.ToInt32(RepNameDropDownList.SelectedValue); var listRecentAddedMoney = new List <DeltoneCRM_DAL.CompanyDAL.CompanyView>(); if (repId > 0) { var numberAccount = Convert.ToInt32(NumberAccountDropDownList.SelectedValue); var allocTime = GetAllocationTime(); var currentDate = DateTime.Now; var comDal = new CompanyDAL(CONNSTRING); Random rnd = new Random(); for (var i = 0; i < numberAccount; i++) { var newHouseAccount = GetNewHouseCompany(coViewAll, repId); if (newHouseAccount != null) { listRecentAddedMoney.Add(newHouseAccount); comDal.InsertLead(newHouseAccount.CompanyID, repId, currentDate, allocTime); } } Session["recentAddedCompany"] = listRecentAddedMoney; } else { messagelable.Text = "Please Select Rep"; } }
private DeltoneCRM_DAL.CompanyDAL.CompanyView GetNewHouseCompany(List <DeltoneCRM_DAL.CompanyDAL.CompanyView> coViewAll, int repId) { var comDal = new CompanyDAL(CONNSTRING); var listCompanylead = comDal.GetLeadCompanies(); Random rnd = new Random(); var currentDate = DateTime.Now; var pickedCom = coViewAll.OrderBy(x => rnd.Next()).Take(1).ToList(); if (pickedCom.Count > 0) { var pickedObj = pickedCom[0]; if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID)) { return(GetNewHouseCompany(coViewAll, repId)); } else if (listCompanylead.Any(x => x.CompanyId == pickedObj.CompanyID && x.UserId == repId)) { return(GetNewHouseCompany(coViewAll, repId)); } else { return(pickedObj); } } return(null); }
protected void Page_Load(object sender, EventArgs e) { PageSize = Convert.ToInt32(ddlPageSize.SelectedValue); gvEmailSchedule.PageSize = PageSize; if (!IsPostBack) { CompanyDAL newCompanyDal = new CompanyDAL(); IList <Company> companies = newCompanyDal.GetAllCompany(); foreach (Company company in companies) { ListItem item = new ListItem(); item.Text = company.CompanyName.Substring(0, company.CompanyName.Length > 45?45:company.CompanyName.Length); item.Value = company.CompanyRegID.ToString(); ddlSearchCompany.Items.Add(item); } TAFDAL newTAF = new TAFDAL(); IList <TAFTemplate> templates = newTAF.GetAllTAFTemplates(); foreach (TAFTemplate template in templates) { ListItem item = new ListItem(); item.Text = template.TemplateName; item.Value = template.TemplateID.ToString(); ddlSearchTemplate.Items.Add(item); } } }
public List <Company> getAllCompanies() { if (SafeUser != null && SafeUser.isLoggedIn()) { try { SqlHelper helper = new SqlHelper(); SecurityDAL sdal = new SecurityDAL(helper); if (sdal.hasPermission(SafeUser.SignIN.UID, "SELECT")) { helper.Close(); helper = new SqlHelper(); CompanyDAL dal = new CompanyDAL(helper); var companies = dal.getAllcompanies(); helper.Close(); return(companies); } }catch (Exception ex) { log(ex); } } return(null); }
protected void btnAddNewComp_Click(object sender, EventArgs e) { string confirmValue = Request.Form["confirm_value"]; if (confirmValue == "Yes") { //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked YES!')", true); } else { // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('You clicked NO!')", true); } CompanyDAL compdal = new CompanyDAL(); Company com = new Company(); compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString(); com.Name = tbAddCompany.Text; com.Country = tbAddCountry.Text; com.NameAr = tbAddArname.Text; com.Site = tbAddCompanytxt.Text; compdal.InsertCompany(com); gvCompany.EditIndex = -1; tbAddCompany.Text = string.Empty; tbAddCountry.Text = string.Empty; tbAddArname.Text = string.Empty; tbAddCompanytxt.Text = string.Empty; FillCompany(); }
private static void AddCompanies(List <DeltoneCRM_DAL.CompanyDAL.CompanyView> objLst, string numberOfAccount, string allocationPeriod, int RepId) { var repId = RepId; string CONNSTRING = ConfigurationManager.ConnectionStrings["ConnStringDeltoneCRM"].ConnectionString; var listRecentAddedQuotes = new List <DeltoneCRM_DAL.CompanyDAL.CompanyView>(); if (repId > 0) { var numberAccount = Convert.ToInt32(numberOfAccount); var allocTime = GetAllocationTime(allocationPeriod); var currentDate = DateTime.Now; var comDal = new CompanyDAL(CONNSTRING); Random rnd = new Random(); for (var i = 0; i < numberAccount; i++) { var newAccountQuote = GetNewCompaySel(objLst, repId); if (newAccountQuote != null) { listRecentAddedQuotes.Add(newAccountQuote); comDal.InsertLead(newAccountQuote.CompanyID, repId, currentDate, allocTime); } } } }
public void DeleteCompany() { CompanyDAL companyDAL = new CompanyDAL(); int companyId = companyDAL.GetCompanies().Max(x => x.Id); companyDAL.DeleteCompany(companyId); Assert.True(companyDAL.GetCompanyById(companyId) == null); }
public bool AddCompany(CompanyDetailsEntities companyDetail) { ICompanyDAL addCompanyDAL = new CompanyDAL(); var companyDAL = addCompanyDAL.AddCompanyDAL(companyDetail); var abc = companyDetail; return(companyDAL); }
public B2dCompany GetCompany(Int64 xid) { var comp = CompanyDAL.GetCompany(xid); //狀態語系文字對應 comp.STATUS_DESC = GetFieldStatus(comp.STATUS); return(comp); }
public void FetchCompany() { CompanyDAL CompDAL = new CompanyDAL { ConnectionString = ConfigurationManager.ConnectionStrings["MySQLTest"].ToString() }; GVCompany.DataSource = CompDAL.GetCompany(null); GVCompany.DataBind(); }
public static void DeleteField(string CompanyID, string ID, string FieldName, string TableType) { DataHelper.ExecuteQuerys("ALTER TABLE " + CompanyDAL.GetTableName(CompanyID, TableType) + " Drop column " + FieldName); FieldDAL.DeleteField(ID); string where = "CompanyID='{0}' and TableType ='{1}'"; DataSet ds = FieldDAL.GetFieldList(string.Format(where, CompanyID, TableType)); HttpContext.Current.Cache[Tools.GetCashName(CompanyID, TableType)] = ds; }
/// <summary> /// This method is used to get restricted list settings. /// </summary> /// <param name="sConnectionString"></param> /// <returns></returns> public RestrictedListSettingsDTO GetRestrictedListSettings(string sConnectionString) { List <CompanySettingConfigurationDTO> lstCompanySettingConfigurationDTO = null; RestrictedListSettingsDTO objRestrictedListSettingsDTO = null; try { objRestrictedListSettingsDTO = new RestrictedListSettingsDTO(); using (var objCompanyDAL = new CompanyDAL()) { //get list for restricted list setting lstCompanySettingConfigurationDTO = objCompanyDAL.GetCompanySettingConfigurationList(sConnectionString, Common.ConstEnum.Code.CompanyConfigType_RestrictedListSetting); //set restricted list setting foreach (CompanySettingConfigurationDTO configSettingDTO in lstCompanySettingConfigurationDTO) { switch (configSettingDTO.ConfigurationCodeId) { case Common.ConstEnum.Code.RestrictedListSetting_Preclearance_required: objRestrictedListSettingsDTO.Preclearance_Required = Convert.ToInt32(configSettingDTO.ConfigurationValueCodeId); break; case Common.ConstEnum.Code.RestrictedListSetting_Preclearance_Approval: objRestrictedListSettingsDTO.Preclearance_Approval = Convert.ToInt32(configSettingDTO.ConfigurationValueCodeId); break; case Common.ConstEnum.Code.RestrictedListSetting_Preclearance_Allow_Zero_Balance: objRestrictedListSettingsDTO.Preclearance_AllowZeroBalance = Convert.ToInt32(configSettingDTO.ConfigurationValueCodeId); break; case Common.ConstEnum.Code.RestrictedListSetting_Preclearance_Form_F_Required: objRestrictedListSettingsDTO.Preclearance_FORM_Required_Restricted_company = Convert.ToInt32(configSettingDTO.ConfigurationValueCodeId); break; case Common.ConstEnum.Code.RestrictedListSetting_Preclearance_Form_F_TemplateFile: objRestrictedListSettingsDTO.Preclearance_Form_F_File_Id = Convert.ToInt32(configSettingDTO.ConfigurationValueOptional); break; case Common.ConstEnum.Code.RestrictedListSetting_Allow_Restricted_List_Search: objRestrictedListSettingsDTO.Allow_Restricted_List_Search = Convert.ToInt32(configSettingDTO.ConfigurationValueCodeId); objRestrictedListSettingsDTO.RLSearchLimit = configSettingDTO.RLSearchLimit; break; } } } } catch (Exception exp) { throw exp; } finally { lstCompanySettingConfigurationDTO = null; } return(objRestrictedListSettingsDTO); }
public IActionResult Review() { var aesUserData = User.FindFirst(ClaimTypes.UserData).Value; var UserData = JsonConvert.DeserializeObject <B2dAccount>(AesCryptHelper.aesDecryptBase64(aesUserData, Website.Instance.AesCryptKey)); var xid = UserData.COMPANY_XID; B2dCompany model = CompanyDAL.GetCompany(xid); return(View(model)); }
public IEnumerable <CompanyMaster> Get() { CommonAPI commonApi = new CommonAPI(); commonApi.getHeaderValues(Request.Headers, out connectionString, out userAccount, out roleId, out companyCode, out DBProviderName); CompanyDAL companyDAL = new CompanyDAL(connectionString, userAccount, roleId, DBProviderName, companyCode); var companies = companyDAL.GetCompanies(); return(companies); }
public ReturnResult Post([FromBody] CompanyMaster objCompany) { CommonAPI commonApi = new CommonAPI(); commonApi.getHeaderValues(Request.Headers, out connectionString, out userAccount, out roleId, out companyCode, out DBProviderName); CompanyDAL companyDAL = new CompanyDAL(connectionString, userAccount, roleId, DBProviderName, companyCode); ReturnResult returnResult = companyDAL.SaveCompany(objCompany); return(returnResult); }
public void InitCompaniesList(ObservableCollection <CompanyModel> CompaniesToWindow) { CompanyDAL companyDAL = new CompanyDAL(); List <CompanyModel> companies = companyDAL.GetCompanies(); foreach (var item in companies) { CompaniesToWindow.Add(item); } }
public void CheckMemberByCardNumberTest() { int companyId = CompanyDAL.GetCompanies().Select(x => x.Id).Min(); List <MemberModel> members = MemberDAL.GetMembersOfCompany(companyId); string cardnumber = members.First().CardNumber; DataBaseLayer db = new DataBaseLayer(); Test1702.Model.MemberModel testmodel = db.CheckMemberByCardNumber(cardnumber); Assert.That(testmodel != null, Is.True); }
protected void gvCompany_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteCompany") { CompanyDAL compdal = new CompanyDAL(); compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString(); compdal.DeleteCompany(e.CommandArgument.ToString()); FillCompany(); } }
private void SetAdditionalData() { if (CompanyID != 0) { CompanyDAL comp = new CompanyDAL(); _CompanyInfo = comp.GetCompany(CompanyID); PropertyDAL prop = new PropertyDAL(); _PropertyInfo = prop.GetProperties(CompanyID); } }
private void FillCompany(String Name) { CompanyDAL Compdal = new CompanyDAL(); Compdal.ConnectionString = ConfigurationManager.ConnectionStrings["MySQLConn"].ToString(); List <Company> CompanyList = Compdal.GetCompany(Name); gvCompany.DataSource = CompanyList; gvCompany.DataBind(); }