//绑定公司类别 //private void bindList() //{ // this.ddlList.Items.Clear(); // IList<ComType> typelist = ComTypeManager.getComTypeAll(); // foreach (var item in typelist) // { // ListItem list = new ListItem(item.TypeName, item.Id.ToString()); // this.ddlList.Items.Add(list); // } // ListItem ltem = new ListItem("选择类别", "-1");//添加第一行默认值 // this.ddlList.Items.Insert(0, ltem);//添加第一行默认值 //} protected void imgbtnsave_Click(object sender, ImageClickEventArgs e) { string comCode = this.comCode.Value.ToString(); //公司代码 string comShortName = this.comshort.Value.ToString(); //公司简称 string comCname = this.comCName.Value.ToString(); //公司全称 string str = ""; //if (CompanyManager.getCode(comCode)) //{ // str += "公司代码已存在\\n"; // this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + str + "');", true); // return; //} //判断公司简称是否存在 if (CompanyManager.getSName(comShortName, 0)) { str += "公司简称已存在\\n"; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + str + "');", true); return; } //判断公司全称是否存在 if (CompanyManager.getCName(comCname, 0)) { str += "公司全称已存在\\n"; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "alert('" + str + "');", true); return; } addBase(); }
public void TestGetEventTypes() { var dal = new CompanyManager(); var table = dal.GetEventTypes(); Assert.Greater(table.Rows.Count, 0); }
/// <summary> /// 根据公司ID和宗地名称获取“土地证.jpg”的路径 /// </summary> /// <param name="CompanyID"></param> /// <param name="parcelname"></param> /// <returns></returns> public static string GetLandusepicPath(int CompanyID, string parcelname) { //CompanyManager.getSingleton().init(); string parentPath = CompanyManager.getSingleton().GetCompanyFullName(CompanyID); return(HttpRuntime.AppDomainAppPath + parentPath + parcelname + "\\土地证.jpg"); }
private void DeletePromotion(object parameter) { CompanyManager.DeletePromotion(CompanyId, Promotion, Identifier); Debug.WriteLine("Delete Promotion Called"); ((Window.Current.Content as Frame)?.Content as MainPage)?.contentFrame.Navigate(typeof(DashboardPage)); }
// Start is called before the first frame update void Awake() { CompanyManagerCall = GameObject.Find("CompanyManager").GetComponent <CompanyManager>(); CompanyValueCall = CompanyManagerCall.GetPlayerCompanyValue(); TechValueCall = CompanyValueCall.GetTechValue().GetComponent <TechValue>(); ValueCall = GameObject.Find("BaseSystem").GetComponent <InGameValue>(); }
/// <summary> /// 根据公司ID、宗地名称和建筑名称获取“外墙实景图.JPG”的路径 /// </summary> /// <param name="CompanyID"></param> /// <param name="parcelname"></param> /// <param name="buildingname"></param> /// <returns></returns> public static string GetVirtualmapPath(int CompanyID, string parcelname, string buildingname) { //CompanyManager.getSingleton().init(); string parentPath = CompanyManager.getSingleton().GetCompanyFullName(CompanyID); return(HttpRuntime.AppDomainAppPath + parentPath + parcelname + "\\" + buildingname + "\\外墙实景图.JPG"); }
/// <summary> /// 根据公司ID、宗地名称、建筑名称和图片名字获取分层分户平面图的路径 /// </summary> /// <param name="CompanyID"></param> /// <param name="parcelname"></param> /// <param name="buildingname"></param> /// <param name="picname"></param> /// <returns></returns> public static string GetPlanpicPath(int CompanyID, string parcelname, string buildingname, string picname) { //CompanyManager.getSingleton().init(); string parentPath = CompanyManager.getSingleton().GetCompanyFullName(CompanyID); return(HttpRuntime.AppDomainAppPath + parentPath + parcelname + "\\" + buildingname + "\\" + picname + ".jpg"); }
public ActionResult Report() { ViewBag.categoryList = CategoryManager.GetAllCategories(); ViewBag.companyList = CompanyManager.GetAllCompanys(); ViewBag.itemList = null; return(View()); }
private void BuildDeptTree() { tvwDepart.Nodes.Clear(); // 先清空TreeView的所有节点 Company comp = new Company(); CompanyManager compMgr = new CompanyManager(); comp = compMgr.GetCompanyInfo(); if (comp != null) { //根节点处显示公司名 TreeNode root = new TreeNode(comp.Name, 0, 0); //将根节点加入TreaeView中 tvwDepart.Nodes.Add(root); DepartmentManager deptMgr = new DepartmentManager(); DataTable dt = deptMgr.GetDeptInfo(); for (int i = 0; i < dt.Rows.Count; i++) { DataRow row = dt.Rows[i]; // row为dt的第i行 //dt第i行第2列,即部门名显示在TreeNode上 TreeNode treeNode = new TreeNode(row[1].ToString(), 1, 1); // 将dt第i行第1列,即部门id绑定在TreeNode上 treeNode.Tag = row[0]; root.Nodes.Add(treeNode); //将treeNode添加在根节点上 } root.ExpandAll(); // 将所有节点展开 } tvwDepart.LabelEdit = false; // 关闭 TreeView的编辑状态 }
/// <summary> /// Esse método, verifica o número de usuários cadastrados no sistema através do CompanyReferenceId ///ou seja, todas as Empresas interligadas. Sendo maior ou igual do que o número máximo permitido pelo ///plano, o botão de inserção, some da tela, impossibilitando um novo cadastro de usuário. /// </summary> /// <param name="e"></param> protected override void OnPreRender(EventArgs e) { base.OnPreRender(e); CompanyManager cManager = new CompanyManager(this); }
protected void txtUser_TextChanged(object sender, EventArgs e) { onSelectingUser(this, new SelectingUserEventArgs() { UserName = txtUser.Text }); if (txtUser.Text.Contains("|")) { string[] identifications = txtUser.Text.Split('|'); string identification = identifications[0].ToString().Trim(); companyManager = new CompanyManager(this); profileManager = new ProfileManager(this); Profile profile = profileManager.GetProfile(identification); if (profile != null) { user = companyManager.GetUserByProfile(profile.ProfileId); } ShowUser(user); //ShowEmployee(employee); } }
/// <summary> /// 根据公司ID、宗地名称和鸟瞰图的方向获取鸟瞰图的路径 /// </summary> /// <param name="CompanyID"></param> /// <param name="parcelname"></param> /// <param name="direction">正射、前、后、左、右</param> /// <returns></returns> public static string GetAerialviewpicPath(int CompanyID, string parcelname, string direction) { //CompanyManager.getSingleton().init(); string parentPath = CompanyManager.getSingleton().GetCompanyFullName(CompanyID); return(HttpRuntime.AppDomainAppPath + parentPath + parcelname + "\\鸟瞰图\\" + direction + ".JPG"); }
/// <summary> /// 获取公司银行列表 /// </summary> /// <param name="companyID"></param> /// <returns></returns> private string GetCompanyBankList(int companyID) { DataTable dtBankList = ComBankManager.getList(companyID); StringBuilder htmlBuilder = new StringBuilder(); EtNet_Models.Company company = CompanyManager.getCompanyById(companyID); if (company != null) { htmlBuilder.AppendFormat("<option value=\"{0}\">", company.CardId + "$" + company.CardName + "$" + company.Remark); //htmlBuilder.Append("<option value=\"0\">"); htmlBuilder.Append(company.Bank); htmlBuilder.Append("</option>"); } if (dtBankList.Rows.Count > 0) { int rowCount = dtBankList.Rows.Count; for (int i = 0; i < rowCount; i++) { DataRow currentRow = dtBankList.Rows[i]; htmlBuilder.AppendFormat("<option value=\"{0}\">", currentRow["id"]); htmlBuilder.Append(currentRow["bank"]); htmlBuilder.Append("</option>"); } } return(htmlBuilder.ToString()); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Util.AlignRadDatePicker(dp_start_date); Util.AlignRadDatePicker(dp_end_date); Security.BindPageValidatorExpressions(this); if (Util.IsBrowser(this, "IE")) { rfd.Visible = false; } if (Request.QueryString["off"] != null && !String.IsNullOrEmpty(Request.QueryString["off"])) { hf_office.Value = Request.QueryString["off"]; Util.MakeCountryDropDown(dd_country); BindReps(); String CompanyID = CompanyManager.AddTemporaryCompany("Media Sales"); ContactManager.CompanyID = CompanyID; ContactManager.BindContacts(CompanyID); } else { Util.PageMessage(this, "There was an error getting the office information, please close and reload this window."); } } }
public void DoEvents() { var eventManager = new CompanyManager(); var table = eventManager.GetEventsByCo(_companyName); var i = 1; foreach (var row in table) { if (!IsPointUsable(row)) { continue; } /*<DCWC:StripLine BackColor="Gray" BorderColor="Black" Interval="2" * IntervalOffsetType="Days" IntervalType="Days" StripWidth="1" />*/ var minDate = _timeSpanBegins; var l = new StripLine { StripWidth = 0, StripWidthType = DateTimeIntervalType.Days, BackColor = Color.Blue, BorderColor = Color.Blue, Interval = 0, IntervalOffset = (row.event_date - minDate).TotalDays, // row.event_date.ToOADate(), // Title = row.event_type }; i++; _chart.ChartAreas[0].AxisX.StripLines.Add(l); } }
protected override void LookForNewUrl(HttpContext context, string requestedUrl) { base.LookForNewUrl(context, requestedUrl); if (IsUserLogged) { string query = context.Request.Url.Query.Replace("?", ""); using (CompanyManager manager = new CompanyManager(null)) { Company company = manager.GetCompanyByContext(Context); if (company != null) { string newUrl; // // Try the company website // string webSite = ("" + company.LegalEntityProfile.Website).ToLower().Replace("http://", "").Replace("www.", ""); if (!String.IsNullOrEmpty(webSite) && !requestedUrl.Contains(webSite.ToLower())) { newUrl = "~/infocontrol/_companies/" + webSite + "/" + requestedUrl.ToLower().Replace("infocontrol/", ""); // rewrite the path.. if (newUrl != requestedUrl && System.IO.File.Exists(Context.Server.MapPath(newUrl))) { RewritePath(newUrl, String.Empty, query); return; } } } } } }
private IEnumerator Start() { // менеджер локализации while (!LocalizationManager.instance.GetIsReady()) { yield return(null); } // менеджер диалогов while (!CompanyDialogManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер компании while (!CompanyManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер дуэли while (!DuelManager.GetInstance().GetIsReady()) { yield return(null); } // менеджер целей while (!TargetController.GetInstance().GetIsReady()) { yield return(null); } // после загрузки всех компонент - включаем меню SceneManager.LoadScene("MainMenu"); }
/// <summary> /// Loads companies. /// </summary> protected void CompanyDdl_SelectedIndexChanged(object sender, EventArgs e) { try { TableRow row; TableCell cell; List <CompanyManager> companies = CompanyManager.GetCompanies(); if (companyDdl.SelectedItem.Text != "") { AddHeaderRow(); foreach (CompanyManager company in companies.Where(x => x.CompanyID == Convert.ToInt32(companyDdl.SelectedItem.Text.Split(',')[0]))) { //string companyInfo = company.CompanyID.ToString() + ", " + company.CompanyName; //companyDdl.Items.Add(companyInfo); row = new TableRow(); cell = new TableCell(); //cell.Text = company.Address.GetAddressStr(); row.Cells.Add(cell); AddressesTbl.Rows.Add(row); } } } catch (Exception ex) { generalErrorLbl.Text = "An error has occured saying: " + ex.Message + " Please contact your system administrator."; } }
protected void btnDelete_Click(object sender, EventArgs e) { CompanyManager cManager = new CompanyManager(this); char delimiter = new char(); delimiter = ','; //make a list of customers String[] lista = Request["chkCustomer"].Split(delimiter); try { //delete company for (int index = 0; index < lista.Length; index++) { //DeleteRelationshipsOfCompany(Convert.ToInt32(lista[index])); cManager.DeleteCompany(Convert.ToInt32(lista[index])); } } catch (Exception ex) { ClientScript.RegisterClientScriptBlock(this.GetType(), "", "alert('" + ex.Message + "');", true); ShowError("Compahia contendo registros relacionados!"); } grvCustomer.DataBind(); }
protected void btnAddContractTemplate_Click(object sender, ImageClickEventArgs e) { if (String.IsNullOrEmpty(Company.LegalEntityProfile.Website)) { ShowError("A empresa não tem um site configurado! Ex: www.vivina.com.br"); return; } var modelFileName = fupDocumentTemplate.PostedFile.FileName; if (!modelFileName.EndsWith(".htm") && !modelFileName.EndsWith(".html") && !modelFileName.EndsWith(".rtf")) { ShowError("Extensão do documento inválida! Selecione documentos de extensão .htm, .html ou .rtf"); return; } companyManager = new CompanyManager(this); var documentTemplate = new DocumentTemplate { CompanyId = Company.CompanyId, FileName = fupDocumentTemplate.FileName, FileUrl = Company.GetDocumentTemplateDirectory() + fupDocumentTemplate.PostedFile.FileName, DocumentTemplateTypeId = Convert.ToInt32(cboDocumentTemplateTypes.SelectedValue) }; companyManager.InsertDocumentTemplate(documentTemplate); grdDocumentsTemplate.DataBind(); // // Save in Hard Disk // fupDocumentTemplate.SaveAs(Server.MapPath(documentTemplate.FileUrl)); }
public void ChangeHead_ValidData_ChangesHead() { CompanyManager cm = new CompanyManager(new Company("Test")); cm.NewHead("Head"); cm.ChangeHead("SecondHead"); }
private void BindTemplate() { String qry = "SELECT dbl_lead.*, db_company.*, db_contact.ctc_id " + "FROM dbl_lead, db_contact, db_company " + "WHERE dbl_lead.ContactID = db_contact.ctc_id " + "AND db_contact.new_cpy_id = db_company.cpy_id " + "AND dbl_lead.LeadID=@LeadID;"; DataTable dt_lead = SQL.SelectDataTable(qry, "@LeadID", hf_lead_id.Value); if (dt_lead.Rows.Count > 0) { String cpy_id = dt_lead.Rows[0]["cpy_id"].ToString(); String ctc_id = dt_lead.Rows[0]["ctc_id"].ToString(); String project_id = dt_lead.Rows[0]["ProjectID"].ToString(); hf_project_id.Value = project_id; hf_parent_project_id.Value = LeadsUtil.GetProjectParentIDFromID(hf_project_id.Value); hf_cpy_id.Value = cpy_id; hf_ctc_id.Value = ctc_id; // Bind Company and Contacts CompanyManager.BindCompany(cpy_id); ContactManager.BindContact(ctc_id); // Bind Notes and Next Action ContactNotesManager.LeadID = hf_lead_id.Value; ContactNotesManager.Bind(ctc_id); // Bind Other Contacts BindOtherContacts(null, null); // Bind destination projects LeadsUtil.BindProjects(dd_projects, dd_buckets, hf_parent_project_id.Value, hf_project_id.Value, true); } }
/**********************************************************************************/ // функция дерегестрирует цель // производится проверка выигрыша игрока // /**********************************************************************************/ public void TargetIsDead(GameObject target) { if (GameManager.GetInstance().GameMode == GameManager.GAME_MODE.SINGLE) { CIGameObject gmo = target.GetComponent <CIGameObject>(); if (gmo.GOType == Base.GO_TYPE.PLAYER) { CompanyManager.GetInstance().OnGoalsFailed(); } else { m_npcTarget.Remove(gmo.ID); // обновляем текущую сложность int bossWeight = m_bossWeights[gmo.GOType.ToString()]; m_currentDifficulties -= bossWeight; UpdateNPCTargets(); if (m_npcTarget.Count == 0) { CompanyManager.GetInstance().OnGoalsAchieved(); } } } else { PlayerController pc = target.GetComponent <PlayerController>(); DuelManager.GetInstance().OnGoalAchived(pc.playerId); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Util.SetRebindOnWindowClose(this, false); if (Request.QueryString["cpy_id"] != null && !String.IsNullOrEmpty(Request.QueryString["cpy_id"]) && Request.QueryString["cpy_type"] != null && !String.IsNullOrEmpty(Request.QueryString["cpy_type"]) && Request.QueryString["issue"] != null && !String.IsNullOrEmpty(Request.QueryString["issue"])) { hf_cpy_id.Value = Request.QueryString["cpy_id"]; hf_cpy_type.Value = Request.QueryString["cpy_type"]; hf_issue.Value = Request.QueryString["issue"]; switch (hf_cpy_type.Value) { case "f": hf_cpy_type.Value = "Feature"; ContactManager.IncludeContactTypes = false; ContactManager.TargetSystem = String.Empty; break; case "a": hf_cpy_type.Value = "Advert"; break; } CompanyManager.SmartSocialIssue = hf_issue.Value; CompanyManager.SmartSocialCompanyType = hf_cpy_type.Value; CompanyManager.BindCompany(hf_cpy_id.Value); if (Request.QueryString["ctc_id"] != null && !String.IsNullOrEmpty(Request.QueryString["ctc_id"])) { hf_ctc_id.Value = Request.QueryString["ctc_id"]; ContactManager.FocusContactID = hf_ctc_id.Value; } ContactManager.BindContacts(hf_cpy_id.Value); } else { Util.PageMessageAlertify(this, LeadsUtil.LeadsGenericError, "Error"); } } }
public int GetTheCurrentCompanyId() //returns the id of the company that the contractor is linked to. { string userId = User.Identity.GetUserId(); int companyId = CompanyManager.RetrieveCompanyId(userId); return(companyId); }
public void AddWorker_InvalidSupervisorPositionName_ShouldThrowPositionDoesNotExistException() { CompanyManager cm = new CompanyManager(new Company("Test")); cm.NewHead("Head"); Assert.ThrowsException <PositionDoesNotExistException>(() => cm.AddWorker("W1", "M1")); }
public void AddWorker_ValidData_AddsWorkerPosition() { CompanyManager cm = new CompanyManager(new Company("Test")); cm.NewHead("Head"); cm.AddWorker("W1", "Head"); }
public ActionResult Save() { ViewBag.categoryList = CategoryManager.GetAllCategories(); ViewBag.companyList = CompanyManager.GetAllCompanys(); ViewBag.itemList = ItemManager.GetAllItems(); return(View()); }
/// <summary> /// 添加其他银行 /// </summary> private void addcombank() { string banklist = this.hidbank.Value; //得到其他银行信息 if (banklist != "") { string[] row = null; string[] cell = null; EtNet_Models.ComBank combank = null; if (banklist.IndexOf(',') >= 0) { row = banklist.Split(','); } else { row = new string[1] { banklist }; } for (int i = 0; i < row.Length; i++) { combank = new ComBank(); cell = row[i].Split('|'); combank.Bank = cell[0]; //开户银行 combank.CardId = cell[1]; //银行账号 combank.CardName = cell[2]; //户名 combank.Remark = cell[3]; //备注 combank.CompanyId = CompanyManager.getLastOneID().Id; ComBankManager.addComBank(combank); } } }
public void NewHead_HeadAlreadyExists_ShouldThrowCompanyHeadException() { CompanyManager cm = new CompanyManager(new Company("Test")); cm.NewHead("Head"); Assert.ThrowsException <CompanyHeadException>(() => cm.NewHead("SecondHead")); }
public void Test_CompanyMgr_GetAll() { var connection = new SqliteConnection("DataSource=:memory:"); connection.Open(); try { var options = new DbContextOptionsBuilder <HOSContext>() .UseSqlite(connection) .Options; using (var context = new HOSContext(options)) { context.Database.EnsureCreated(); } using (var context = new HOSContext(options)) { HOSTestData.LoadCompanyTable(context); } using (var context = new HOSContext(options)) { ICompanyManager companyMgr = new CompanyManager(new Repository(context)); var companies = companyMgr.GetAll().ToList(); Assert.NotNull(companies); Assert.Equal(7, companies.Count()); } } finally { connection.Close(); } }
public IActionResult Get(string id) { CompanyManager cm = new CompanyManager(); var item = cm.GetAll(rowKey: id).Result.SingleOrDefault(); // _items.FirstOrDefault(x => x.Id == id); if (item == null) { return HttpNotFound(); } return new ObjectResult(item); }
/// <summary> /// This method delete Relationships of specific Company /// </summary> /// <param name="companyId"></param> public void DeleteRelationshipsOfCompany(Int32 companyId) { var company = new CompanyManager(this).GetCompany(Convert.ToInt32(companyId)); foreach (PropertyInfo propertyItem in company.GetType().GetProperties()) { if (propertyItem.Name != "CompanyId") { company.SetPropertyValue(propertyItem.Name, null); } } }
public static bool DisassociateUser(int userId, int companyId) { bool result = true; using (CompanyManager companyManager = new CompanyManager(null)) { try { companyManager.DisassociateUser(userId, companyId); } catch (System.Data.SqlClient.SqlException e) { result = false; } } return result; }
public void DoWork() { using (var companyManager = new CompanyManager(null)) using (var financialManager = new FinancialManager(null)) { // Para cada empresa verifica se tem parcela em atraso foreach (var company in companyManager.GetAllCompanies()) { // Se tiver parcela em atraso bloqueia a empresa // Se náo tiver verifica se é o dia da próxima fatura if (company.NextStatementDueDate.Date.Equals(DateTime.Now.Date)) companyManager.GenerateStatement(company); } } }
protected void Page_Load(object sender, EventArgs e) { companyManager = new CompanyManager(this); if (Context.Items["CompanyId"] != null) Page.ViewState["CompanyId"] = Context.Items["CompanyId"]; if (Request.QueryString["CompanyId"] != null) Page.ViewState["CompanyId"] = Request.QueryString["CompanyId"]; if (Page.ViewState["CompanyId"] != null) { Page.ViewState["loaded"] = true; originalCompany = companyManager.GetCompany(Convert.ToInt32(ViewState["CompanyId"])); if (!IsPostBack && originalCompany != null) { Profile_LegalEntity1.CompanyProfileEntity = originalCompany.LegalEntityProfile; loadMatrixName(); ListItem listItem = cboMatrixId.Items.FindByValue(originalCompany.MatrixId.ToString()); if (listItem != null) cboMatrixId.SelectedValue = listItem.Value; } } else if (Page.ViewState["LegalEntityProfileId"] != null) { originalCompany = companyManager.GetCompanyByProfile(Convert.ToInt32(Page.ViewState["LegalEntityProfileId"])); if (originalCompany != null) { Page.ViewState["ProfileExists"] = "0"; /*if isn't a postback set the values of company in profile_LegalEntity1 * else the values are reload in all postback */ if (!IsPostBack) { Profile_LegalEntity1.CompanyProfileEntity = originalCompany.LegalEntityProfile; loadMatrixName(); cboMatrixId.Items.FindByValue(originalCompany.MatrixId.ToString()).Selected = true; } } } }
public void Put(string id, [FromBody]CompanyEntity item) { if (!ModelState.IsValid) { HttpContext.Response.StatusCode = 400; } else { CompanyManager cm = new CompanyManager(); var res = cm.Save(item); res.Wait(); string url = Url.RouteUrl("Get", new { id = item.Id }, Request.Scheme, Request.Host.ToUriComponent()); HttpContext.Response.StatusCode = 201; HttpContext.Response.Headers["Location"] = url; } }
protected void txtUser_TextChanged(object sender, EventArgs e) { onSelectingUser(this, new SelectingUserEventArgs() { UserName = txtUser.Text }); if (txtUser.Text.Contains("|")) { string[] identifications = txtUser.Text.Split('|'); string identification = identifications[0].ToString().Trim(); companyManager = new CompanyManager(this); profileManager = new ProfileManager(this); Profile profile = profileManager.GetProfile(identification); if (profile != null) user = companyManager.GetUserByProfile(profile.ProfileId); ShowUser(user); //ShowEmployee(employee); } }
protected void Page_Load(object sender, EventArgs e) { txtName.Focus(); cboTaskStatus.DataBind(); _taskManager = new TaskManager(this); var companyManager = new CompanyManager(this); if (!IsPostBack) { //ucEndDate.DateTime = ucBeginDate.DateTime = DateTime.Today; if (!String.IsNullOrEmpty(Request["ServiceOrderId"])) Page.ViewState["ServiceOrderId"] = Request["ServiceOrderId"]; // In case of task has been generated from appointment if (!String.IsNullOrEmpty(Request["StartDate"]) && !String.IsNullOrEmpty(Request["EndDate"])) { ucBeginDate.DateTime = Convert.ToDateTime(Request["StartDate"]); ucEndDate.DateTime = Convert.ToDateTime(Request["EndDate"]); } Users = null; if (!String.IsNullOrEmpty(Request["TaskId"])) { Page.ViewState["TaskId"] = Convert.ToInt32(Request["TaskId"]); ShowTask(); } else { Users.Add(companyManager.GetUser(Company.CompanyId, User.Identity.UserId)); BindListUser(); } } ucComments.Visible = (Request["TaskId"] != null); }
public async void Post([FromBody]CompanyEntity item) { if (!ModelState.IsValid) { HttpContext.Response.StatusCode = 400; } else { item.Id = Guid.NewGuid(); item.Label = Configuration.Instance.Label.Id; CompanyManager cm = new CompanyManager(); var res = cm.Save(item); res.Wait(); string url = Url.RouteUrl("Get", new { id = item.Id }, Request.Scheme, Request.Host.ToUriComponent()); HttpContext.Response.StatusCode = 201; HttpContext.Response.Headers["Location"] = url; } }
private void SaveCustomerCall() { CustomerCall customerCall = new CustomerCall(); CompanyManager companyManager = new CompanyManager(this); Comment comment = new Comment(); Int32 tmp = 0; if (this.Page.ViewState["CustomerCallId"] == null) customerCall.UserId = User.Identity.UserId; if (Int32.TryParse(Convert.ToString(Page.ViewState["CustomerCallId"]), out tmp)) { original_CustomerCall = CustomerManager.GetCustomerCall(Convert.ToInt32(Page.ViewState["CustomerCallId"])); customerCall.CopyPropertiesFrom(original_CustomerCall); } // if this page was opened in PopUp way, save this customerCall as Host's customerCall customerCall.CompanyId = Company.CompanyId; if (Page.ViewState["ModalPopUp"] == null) if (!Int32.TryParse(Convert.ToString(Page.ViewState["CustomerId"]), out tmp)) { ShowError(Resources.Exception.UnselectedCustomer); return; } customerCall.CustomerId = Convert.ToInt32(Page.ViewState["CustomerId"]); if (Convert.ToInt32(Page.ViewState["ModalPopUp"]) == 1) { customerCall.CustomerId = CustomerManager.GetHostCustomerByLegalEntityProfileId(Company.LegalEntityProfileId).CustomerId; customerCall.CompanyId = HostCompany.CompanyId; } customerCall.RepresentantId = null; if (!String.IsNullOrEmpty(cboRepresentant.SelectedValue)) customerCall.RepresentantId = Convert.ToInt32(cboRepresentant.SelectedValue); customerCall.Rating = rtnPriority.CurrentRating; customerCall.CustomerCallStatusId = Convert.ToInt32(cboCustomerCallStatus.SelectedValue); customerCall.CustomerCallTypeId = Convert.ToInt32(cboCustomerCallType.SelectedValue); customerCall.CallNumber = txtCallNumber.Text; customerCall.CallNumberAssociated = txtCallNumberAssociated.Text; customerCall.Sector = txtSector.Text; customerCall.Description = txtDescription.Value; customerCall.Subject = txtSubject.Text; if (!String.IsNullOrEmpty(cboTechnicalEmployee.SelectedValue)) customerCall.TechnicalEmployeeId = Convert.ToInt32(cboTechnicalEmployee.SelectedValue); if (!String.IsNullOrEmpty(cboCustomerEquipments.SelectedValue)) customerCall.CustomerEquipmentId = Convert.ToInt32(cboCustomerEquipments.SelectedValue); if (original_CustomerCall != null) { customerCall.ModifiedByUser = User.Identity.UserName; CustomerManager.UpdateCustomerCall(original_CustomerCall, customerCall); } else { customerCall.CreatedByUser = User.Identity.UserName; CustomerManager.InsertCustomerCall(customerCall, null, null, null); CommentsCustomerCall.SubjectId = customerCall.CustomerCallId; } Context.Items["CustomerCallId"] = customerCall.CustomerCallId; if (Page.ViewState["SO"] != null) { Server.Transfer("../Services/ServiceOrder.aspx"); return; } if (Page.ViewState["ModalPopUp"] == null) Response.Redirect("CustomerCalls.aspx"); }
public void Delete(string id) { CompanyManager cm = new CompanyManager(); var item = cm.GetAll(rowKey: id).Result.SingleOrDefault(); // _items.FirstOrDefault(x => x.Id == id); //if (item != null) //{ // return HttpNotFound(); //} var res = cm.Delete(item); res.Wait(); string url = Url.RouteUrl("Get", new { id = item.Id }, Request.Scheme, Request.Host.ToUriComponent()); HttpContext.Response.StatusCode = 201; HttpContext.Response.Headers["Location"] = url; }
public IEnumerable<CompanyEntity> Get() { CompanyManager cm = new CompanyManager(); return cm.GetAll().Result; }
protected void cboCompanies_SelectedIndexChanged(object sender, EventArgs e) { using (var manager = new CompanyManager(null)) manager.ChangeCompany(Page.User.Identity.UserId, int.Parse(cboCompanies.SelectedValue)); RefreshCompany(); RefreshPlan(); RefreshDeposit(); Page.ClientScript.RegisterStartupScript(GetType(), "ResetAll", "top.ResetAll();", true); if (Page.User.Identity.UserId > 1) User.RefreshCredentials(); }
private bool CheckIfCanSale(int productId, int quantity) { Deposit dep = new Deposit(); User user = new User(); CompanyManager cManager = new CompanyManager(this); InventoryManager iManager = new InventoryManager(this); // // Verifies wich deposit are the active deposit to this Company / User // user.UserId = (Page as InfoControl.Web.UI.DataPage).User.Identity.UserId; dep = cManager.GetCurrentDeposit(user.UserId, Company.CompanyId); // // Get the data of the respectively inventory // var prod = iManager.GetProductInventory(Company.CompanyId, productId, Deposit.DepositId); // // Compare the Inventory Quantity wich the Sale quantity, if the Sale Quantity are // less than the Inventory, the Can Sale flag will be true, else the sale will be canceled // if (quantity <= prod.Quantity) return true; else return false; }
protected void btnSave_Click(object sender, EventArgs e) { //Manager InventoryManager iManager = new InventoryManager(this); CompanyManager cManager = new CompanyManager(this); //these Objects are Initialized in loop because its necessary provide the Insert with new objects Inventory inv; InventoryMoviment mov; InventoryHistory his; DataTable productList = (DataTable)Page.ViewState["ProductList"]; Inventory inventoryData = new Inventory(); Product prod = new Product(); Deposit dep = new Deposit(); if (productList.Rows.Count <= 1) { ShowError(Resources.Exception.SelectProduct); return; } productList.Rows.RemoveAt(0); dep = cManager.GetCurrentDeposit(User.Identity.UserId, Company.CompanyId); try { foreach (DataRow row in productList.Rows) { inv = new Inventory(); if (Deposit != null) inv.DepositId = dep.DepositId; inv.CompanyId = Company.CompanyId; inv.ProductId = Convert.ToInt16(row["ProductId"]); inv.Quantity = Convert.ToInt16(row["Quantity"]); mov = new InventoryMoviment(); mov.CompanyId = inv.CompanyId; mov.DepositId = inv.DepositId; mov.DepositDestinationId = Convert.ToInt16(cboDeposit.SelectedValue); mov.ModifiedDate = DateTime.Now; mov.ProductId = inv.ProductId; mov.Quantity = inv.Quantity; mov.CompanyDestinationId = Convert.ToInt16(cboCompany.SelectedValue); mov.Refused = false; if (Deposit != null) { iManager.InsertStockMovement(inv, mov, Convert.ToInt32(row["Quantity"]), User.Identity.UserId); } else { ShowError("O usuário não está vinculado a nenhum inventário!"); return; } Session["CompanySender"] = Company.CompanyId; } } catch (InvalidOperationException ex) { ShowError(Resources.Exception.InvalidStockQuantity); return; } InSuccess(); }
protected void btnSave_Click(object sender, EventArgs e) { DataTable productList = (DataTable)Page.ViewState["ProductList"]; Inventory inv = new Inventory(); Product prod = new Product(); Deposit dep = new Deposit(); InventoryMoviment mov = new InventoryMoviment(); InventoryManager iManager = new InventoryManager(this); CompanyManager cManager = new CompanyManager(this); if (productList.Rows.Count < 1) { ShowError("Deve haver pelo menos uma linha com dados do produto."); return; } foreach (DataRow row in productList.Rows) { if (row.Table.Rows.IndexOf(row) != 0) { if (!CheckIfCanSale(Convert.ToInt16(row["ProductId"]), Convert.ToInt16(row["Quantity"]))) { ShowError("O estoque da linha <b>" + Convert.ToInt16((row.Table.Rows.IndexOf(row)) + 1).ToString() + "</b> não pode ficar negativo<br />"); return; } } } productList.Rows.RemoveAt(0); dep = cManager.GetCurrentDeposit(User.Identity.UserId, Company.CompanyId); foreach (DataRow row in productList.Rows) { inv.CompanyId = Company.CompanyId; inv.DepositId = dep.DepositId; inv.ProductId = Convert.ToInt16(row["ProductId"]); inv.Quantity = Convert.ToInt16(row["Quantity"]); mov.CompanyId = inv.CompanyId; mov.DepositId = inv.DepositId; mov.DepositDestinationId = Convert.ToInt16(cboDeposit.SelectedValue); mov.ModifiedDate = DateTime.Now; mov.ProductId = inv.ProductId; mov.Quantity = inv.Quantity; iManager.InventoryDrop(inv, 0, (int)DropType.Transfer, null); iManager.InsertStockMovement(inv, mov, inv.Quantity, User.Identity.UserId); } InSuccess(); }
protected void btnSave_Click(object sender, EventArgs e) { Customer customer = new Customer(); // Clone the original customer for the linq track changes if (originalCustomer != null) { customer.CopyPropertiesFrom(originalCustomer); } customer.BlockSalesInDebit = true; if (Company.MatrixId.HasValue) customer.CompanyId = Company.MatrixId.Value; else customer.CompanyId = Company.CompanyId; customer.BankId = null; if (!String.IsNullOrEmpty(cboBank.SelectedValue)) customer.BankId = Convert.ToInt32(cboBank.SelectedValue); customer.Agency = null; if (!String.IsNullOrEmpty(txtAgency.Text)) customer.Agency = txtAgency.Text; customer.AccountNumber = null; if (!String.IsNullOrEmpty(txtAccountNumber.Text)) customer.AccountNumber = txtAccountNumber.Text; customer.AccountCreatedDate = null; if (!String.IsNullOrEmpty(txtAccountCreatedDate.Text)) customer.AccountCreatedDate = Convert.ToDateTime(txtAccountCreatedDate.Text); ///vendor if (!String.IsNullOrEmpty(cboVendors.SelectedValue)) customer.SalesPersonId = Convert.ToInt32(cboVendors.SelectedValue); if (Page.ViewState["SalesPersonId"] != null) customer.SalesPersonId = Convert.ToInt32(Page.ViewState["SalesPersonId"]); if (ucVendorComission.CurrencyValue.HasValue) customer.SalesPersonCommission = ucVendorComission.CurrencyValue; if (!String.IsNullOrEmpty(cboSupplementalVendor.SelectedValue)) customer.SupplementalSalesPersonId = Convert.ToInt32(cboSupplementalVendor.SelectedValue); if (Page.ViewState["supplementalSalesPersonId"] != null) customer.SupplementalSalesPersonId = Convert.ToInt32(Page.ViewState["supplementalSalesPersonId"]); if (ucSupplementalVendorComission.CurrencyValue.HasValue) customer.SupplementalSalesPersonCommission = ucSupplementalVendorComission.CurrencyValue; customer.RepresentantId = null; if (!String.IsNullOrEmpty(cboRepresentant.SelectedValue)) customer.RepresentantId = Convert.ToInt32(cboRepresentant.SelectedValue); customer.CreditLimit = ucCurrFieldCreditLimit.CurrencyValue; customer.CustomerTypeId = null; if (!String.IsNullOrEmpty(cboCustomerType.SelectedValue)) customer.CustomerTypeId = Convert.ToInt32(cboCustomerType.SelectedValue); //fill field ranking customer.Ranking = rtnRanking.CurrentRating; if (ucProfile.ProfileEntity != null) { if (String.IsNullOrEmpty(ucProfile.ProfileEntity.Phone.Trim('-', '_', '(', ')')) && String.IsNullOrEmpty(ucProfile.ProfileEntity.CellPhone.Trim('-', '_', '(', ')')) && String.IsNullOrEmpty(ucProfile.ProfileEntity.HomePhone.Trim('-', '_', '(', ')'))) { ShowError("Ao menos um telefone deve ser preenchido!"); return; } // Add the entity to Insert if (ucProfile.ProfileEntity.ProfileId == 0) customer.Profile = ucProfile.ProfileEntity; } else { // Add the entity to Insert customer.LegalEntityProfileId = ucProfile.CompanyProfileEntity.LegalEntityProfileId; if (ucProfile.CompanyProfileEntity.LegalEntityProfileId == 0) customer.LegalEntityProfile = ucProfile.CompanyProfileEntity; } // //Insert // if (Page.ViewState["CustomerId"] == null && Page.ViewState["ProfileExists"] != "0") { membershipManager = new MembershipManager(this); companyManager = new CompanyManager(this); if (!String.IsNullOrEmpty(txtUserName.Text)) { customer.CreatedByUser = User.Identity.UserName; status = customerManager.Insert(customer, FillUser()); ShowMessage(status); chkRemoveUser.Visible = (status == MembershipCreateStatus.Success); lblPassword.Visible = txtPassword.Visible = !(status == MembershipCreateStatus.Success); if (status == MembershipCreateStatus.Success) Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true); return; } customer.CreatedByUser = User.Identity.UserName; customerManager.Insert(customer); Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true); } // Update else { membershipManager = new MembershipManager(this); customerManager = new CustomerManager(this); var user = FillUser(); customer.ModifiedByUser = User.Identity.UserName; // //Delete the user account of customer // if (chkRemoveUser.Checked) { customer.User = null; lblMessage.Text = String.Empty; chkRemoveUser.Checked = false; chkRemoveUser.Visible = false; txtUserName.Text = String.Empty; lblPassword.Visible = txtPassword.Visible = true; customerManager.Update(originalCustomer, customer); return; } if (originalCustomer.UserId.HasValue) { if (originalCustomer.User.UserName != txtUserName.Text) { if (customerManager.GetCustomerByUserName(Company.CompanyId, txtUserName.Text) != null) { lblMessage.Text = "Já existe um cliente com esse usuário nesta empresa!"; return; } customerManager.UpdateUserNameOfCustomer(originalCustomer, txtUserName.Text); return; } } if (!String.IsNullOrEmpty(txtUserName.Text) && !originalCustomer.UserId.HasValue) { if (customerManager.GetCustomerByUserName(Company.CompanyId, txtUserName.Text) != null) { lblMessage.Text = "Já existe um cliente com esse usuário nesta empresa!"; return; } membershipManager.Insert(user, out status, true); if (status == MembershipCreateStatus.Success) { customer.UserId = user.UserId; customerManager.Update(originalCustomer, customer); chkRemoveUser.Visible = true; txtPassword.Visible = false; lblPassword.Visible = false; } } customerManager.Update(originalCustomer, customer); // // In case of cnpj/cpf already exists in another category but the same cnpj/cpf is not yet a customer // the data will be loaded and save as update not insert, then this code redirects correctly to finalize // the register. // if (Page.ViewState["CustomerId"] == null) Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "location='Customer.aspx?CustomerId=" + customer.CustomerId + "';", true); } }
protected void btnModel_Click(object sender, EventArgs e) { // // Verify if there's a budget request model for that company // if (String.IsNullOrEmpty(cboBudgetModels.SelectedValue)) { ShowError(Resources.Exception.BudgetDocumentTemplateIsNull); return; } if (IsValidBudget()) { var budget = SaveBudget(); if (budget != null) { BudgetId = budget.BudgetId; var documentTemplate = new CompanyManager(this).GetDocumentTemplate(Convert.ToInt32(cboBudgetModels.SelectedValue)); ExportDocumentTemplate(budget, "SolicitaçãoDeOrçamento" + budget.BudgetCode, documentTemplate); } } }
protected void RegistrarEmpresa(object sender, EventArgs e) { var companyManager = new CompanyManager(this); var planManager = new PlanManager(this); var plan = planManager.GetAllPlans().Where(x => x.Name.Contains(Request["plan"])).FirstOrDefault(); if (plan == null) throw new ArgumentException("O plano não existe!"); var company = new Company { PlanId = plan.PlanId, StartDate = DateTime.Now, ModifiedDate = DateTime.Now, NextStatementDueDate = DateTime.Now.AddMonths(1), LegalEntityProfile = new LegalEntityProfile { CNPJ = txtCNPJ.Text, CompanyName = txtCompanyName.Text, Phone = txtCompanyPhone.Text, PostalCode = adrCompanyAddress.PostalCode, AddressComp = adrCompanyAddress.AddressComp, AddressNumber = adrCompanyAddress.AddressNumber, IE = txtIE.Text } }; var user = new InfoControl.Web.Security.DataEntities.User { UserName = txtEmail.Text, Email = txtEmail.Text, Password = txtSenha.Text, PasswordAnswer = txtSenha.Text, CreationDate = DateTime.Now, LastLockoutDate = DateTime.Now, LastLoginDate = DateTime.Now, LastPasswordChangedDate = DateTime.Now }; var profile = new Profile { CPF = txtCPF.Text, Name = txtNome.Text, ModifiedDate = DateTime.Now, Phone = txtPhone.Text, PostalCode = adrAdminAddress.PostalCode, AddressComp = adrAdminAddress.AddressComp, AddressNumber = adrAdminAddress.AddressNumber }; InsertCompanyStatus status = companyManager.InsertMatrixCompany(company, user, profile); switch (status) { case InsertCompanyStatus.Success: //txtError.Text = "<b> <font color='red'> Empresa registrada com sucesso! </font> </b>"; pnlFormRegister.Visible = false; successMessage.Visible = true; break; case InsertCompanyStatus.DuplicateCNPJ: txtError.Text = "<b> <font color='red'>" + Resources.Exception.CNPJAlreadyExist + " </font> </b>"; break; case InsertCompanyStatus.DuplicatedAdminEmail: txtError.Text = "<b> <font color='red'>" + Resources.Exception.AdministratorEmailAlreadyExist + " </font> </b>"; break; case InsertCompanyStatus.DuplicatedUserName: txtError.Text = "<b> <font color='red'>" + Resources.Exception.AdministratorCPFAlreadyExist + " </font> </b>"; break; case InsertCompanyStatus.InvalidPassword: txtError.Text = "<b> <font color='red'>" + Resources.Exception.InvalidUserPassword + " </font> </b>"; break; default: txtError.Text = "<b> <font color='red'>" + Resources.Exception.AdministratorEmailAlreadyExist + " </font> </b>"; break; } }
protected void btnSave_Click(object sender, EventArgs e) { DataTable productList = (DataTable)Page.ViewState["ProductList"]; Inventory inv = new Inventory(); Inventory inventoryData = new Inventory(); Product prod = new Product(); InventoryRMA rma = new InventoryRMA(); InventoryHistory his = new InventoryHistory(); InventoryManager iManager = new InventoryManager(this); CompanyManager cManager = new CompanyManager(this); if (productList.Rows.Count <= 1) { ShowError(Resources.Exception.InsertProduct); return; } foreach (DataRow row in productList.Rows) { if (row.Table.Rows.IndexOf(row) != 0) { if (!CheckIfCanSale(Convert.ToInt16(row["ProductId"]), Convert.ToInt16(row["Quantity"]))) { ShowError(Resources.Exception.InvalidStockQuantity + " Linha: " + Convert.ToInt16((row.Table.Rows.IndexOf(row)) + 1).ToString()); return; } } } productList.Rows.RemoveAt(0); try { foreach (DataRow row in productList.Rows) { inv.CompanyId = Company.CompanyId; inv.DepositId = Deposit.DepositId; inv.ProductId = Convert.ToInt16(row["ProductId"]); inv.Quantity = Convert.ToInt16(row["Quantity"]); inventoryData = iManager.GetProductInventory(Company.CompanyId, inv.ProductId, inv.DepositId); if (inventoryData != null) { rma.CompanyId = inv.CompanyId; rma.DepositId = inv.DepositId; rma.ModifiedDate = DateTime.Now; rma.ProductId = inv.ProductId; rma.Quantity = inv.Quantity; rma.Substituted = false; rma.SupplierId = Convert.ToInt16(inventoryData.SupplierId); iManager.InventoryDrop(inv, inv.Quantity, (int)DropType.RMA, null); iManager.InsertStockRMA(rma); } } InSuccess(); } catch (Exception ex) { ShowError(Resources.Exception.nonSentProductToRMA); } }
protected void btnSend_Click(object sender, EventArgs e) { string msg = ""; if (sel_customer.CustomerId.HasValue) { if (String.IsNullOrEmpty(sel_customer.Customer.Email) && String.IsNullOrEmpty(txtCustomerMail.Text)) msg = "Cliente sem email!"; } else if (String.IsNullOrEmpty(txtCustomerMail.Text)) msg = "Cliente sem email!"; if (!String.IsNullOrEmpty(msg)) { ShowError(msg); return; } if (String.IsNullOrEmpty(cboBudgetModels.SelectedValue)) { ShowError(Resources.Exception.BudgetDocumentTemplateIsNull); return; } if (IsValidBudget()) { var budget = SaveBudget(); BudgetId = budget.BudgetId; var budgetDocumentTemplate = new CompanyManager(this).GetDocumentTemplate(Convert.ToInt32(cboBudgetModels.SelectedValue)); var directoryTempFile = String.Empty; // // Verifies if the budget will be send with a file attached // if (!budgetDocumentTemplate.FileName.Contains(".html") || !budgetDocumentTemplate.FileName.Contains(".htm")) { directoryTempFile = "C:\\Temp\\SolicitaçãoDeOrçamento" + budget.BudgetCode.Replace("/", "-").Replace("\\", "-") + ".rtf"; try { if (File.Exists(directoryTempFile)) File.Delete(directoryTempFile); // creates the file and copies the content of budget File.AppendAllText(directoryTempFile, saleManager.ApplyBudgetTemplate(budget, Convert.ToInt32(cboBudgetModels.SelectedValue))); saleManager.SendBudgetToCustomer(budget.BudgetId, Company, Convert.ToInt32(cboBudgetModels.SelectedValue), directoryTempFile); ShowAlert("A proposta " + budget.BudgetCode + " foi enviada ao cliente com sucesso!"); File.SetAttributes(directoryTempFile, FileAttributes.Temporary); return; } catch (System.IO.IOException) { ShowError("Erro! Arquivo de modelo já está aberto por outro programa!"); return; } } // // budget in email body // saleManager.SendBudgetToCustomer(budget.BudgetId, Company, Convert.ToInt32(cboBudgetModels.SelectedValue), String.Empty); ShowAlert("A proposta " + budget.BudgetCode + " foi enviada ao cliente com sucesso!"); } }