private void LoadCallRelatedTo() { Business.Sales.Calls Obj = new Business.Sales.Calls(); ddlCallRelatedTo.DataSource = Obj.GetCallRelated(); ddlCallRelatedTo.DataTextField = "Name"; ddlCallRelatedTo.DataValueField = "Id"; ddlCallRelatedTo.DataBind(); ddlCallRelatedTo.InsertSelect(); }
private void SaveCallLink() { Business.Sales.Calls Obj = new Business.Sales.Calls(); Entity.Sales.Calls Model = new Entity.Sales.Calls { Id = CallId, LinkId = Convert.ToInt32(hdnItemId.Value), LinkType = (SalesLinkType)Enum.Parse(typeof(SalesLinkType), hdnItemType.Value) }; Obj.SaveCallLinks(Model); }
private void LoadCallList() { Business.Sales.Calls Obj = new Business.Sales.Calls(); Entity.Sales.GetCallsParam Param = new Entity.Sales.GetCallsParam { StartDateTime = DateTime.MinValue, EndDateTime = DateTime.MinValue, LinkId = OpportunityId, LinkType = SalesLinkType.Opportunity }; gvCalls.DataSource = Obj.GetAllCalls(Param); gvCalls.DataBind(); }
private void GetCallById() { Business.Sales.Calls Obj = new Business.Sales.Calls(); Entity.Sales.Calls calls = Obj.GetCallById(CallId); if (calls.Id != 0) { ddlCallDirection.SelectedValue = calls.CallDirectionId.ToString(); ddlCallRelatedTo.SelectedValue = calls.CallRelatedTo.ToString(); ddlCallRepeatType.SelectedValue = calls.CallRepeatTypeId.ToString(); ddlCallStatus.SelectedValue = calls.CallStatusId.ToString(); txtDescription.Text = calls.Description; txtCallStartDateTime.Value = calls.StartDateTime.ToString("dd MMM yyyy HH:mm tt"); txtCallEndDateTime.Value = calls.EndDateTime.ToString("dd MMM yyyy HH:mm tt"); txtSubject.Text = calls.Subject; chkEmailReminder.Checked = calls.EmailReminder; chkPopupReminder.Checked = calls.PopupReminder; } }
private void Save() { if (CallControlValidation()) { Business.Sales.Calls Obj = new Business.Sales.Calls(); Entity.Sales.Calls Model = new Entity.Sales.Calls { Id = CallId, CallDirectionId = Convert.ToInt32(ddlCallDirection.SelectedValue), CallRelatedTo = Convert.ToInt32(ddlCallRelatedTo.SelectedValue), CallRepeatTypeId = Convert.ToInt32(ddlCallRepeatType.SelectedValue), CallStatusId = Convert.ToInt32(ddlCallStatus.SelectedValue), CreatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name), Description = txtDescription.Text, Subject = txtSubject.Text, StartDateTime = Convert.ToDateTime(txtCallStartDateTime.Value), EndDateTime = Convert.ToDateTime(txtCallEndDateTime.Value), EmailReminder = chkEmailReminder.Checked, PopupReminder = chkPopupReminder.Checked, IsActive = true }; CallId = Obj.SaveCalls(Model); if (CallId > 0) { SaveCallLink(); ClearControls(); LoadCallList(); CallId = 0; Message.IsSuccess = true; Message.Text = "Saved Successfully"; } else { Message.IsSuccess = false; Message.Text = "Unable to save data."; } Message.Show = true; } }
protected void gvCalls_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Ed") { CallId = Convert.ToInt32(e.CommandArgument.ToString()); GetCallById(); Message.Show = false; btnSave.Text = "Update"; } else if (e.CommandName == "Del") { Business.Sales.Calls Obj = new Business.Sales.Calls(); int rows = Obj.DeleteCalls(Convert.ToInt32(e.CommandArgument.ToString())); if (rows > 0) { ClearControls(); LoadCallList(); Message.IsSuccess = true; Message.Text = "Deleted Successfully"; } else { Message.IsSuccess = false; Message.Text = "Data Dependency Exists"; } Message.Show = true; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }
private void LoadCallList() { Business.Sales.Calls Obj = new Business.Sales.Calls(); Entity.Sales.GetCallsParam Param = new Entity.Sales.GetCallsParam { StartDateTime = DateTime.MinValue, EndDateTime = DateTime.MinValue, LinkId = (!string.IsNullOrEmpty(hdnItemType.Value)) ? Convert.ToInt32(hdnItemId.Value) : 0, LinkType = (!string.IsNullOrEmpty(hdnItemType.Value)) ? (SalesLinkType)Enum.Parse(typeof(SalesLinkType), hdnItemType.Value) : SalesLinkType.None }; if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL)) { Param.AssignEngineer = 0; } else { Param.AssignEngineer = int.Parse(HttpContext.Current.User.Identity.Name); } gvCalls.DataSource = Obj.GetAllCalls(Param); gvCalls.DataBind(); }
protected void gvCalls_RowCommand(object sender, GridViewCommandEventArgs e) { try { if (e.CommandName == "Ed") { Response.Redirect(string.Concat("Calls.aspx?id=", OpportunityId, "&itemtype=", SalesLinkType.Account, "&callid=", e.CommandArgument.ToString())); } else if (e.CommandName == "Del") { Business.Sales.Calls Obj = new Business.Sales.Calls(); int rows = Obj.DeleteCalls(Convert.ToInt32(e.CommandArgument.ToString())); if (rows > 0) { ClearControls(); LoadCallList(); Message.IsSuccess = true; Message.Text = "Deleted Successfully"; } else { Message.IsSuccess = false; Message.Text = "Data Dependency Exists"; } Message.Show = true; } } catch (Exception ex) { ex.WriteException(); Message.IsSuccess = false; Message.Text = ex.Message; Message.Show = true; } }