예제 #1
0
        private void updateConversation()
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = string.Empty;

                ProspectClientConversation prosClientConv = new ProspectClientConversation()
                {
                    ProspectClientId  = _prospCustomer.ID,
                    ConversationBy    = txtConversationBy.Text,
                    ConversationDate  = dtConversation.Value,
                    Remarks           = txtRemarks.Text,
                    CreatedOn         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")),
                    CreatedBy         = Program.CurrentUser.Id,
                    UpdatedOn         = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss")),
                    UpdatedBy         = Program.CurrentUser.Id,
                    UpdatedByUserName = Program.CurrentUser.UserName,
                    MachineName       = System.Environment.MachineName
                };

                if (_prospCustomerConversation == null)
                {
                    apiurl = Program.WebServiceUrl + "/" + ADD_CONVERSATION_API;
                }
                else
                {
                    apiurl            = Program.WebServiceUrl + "/" + UPDATE_CONVERSATION_API;
                    prosClientConv.ID = _prospCustomerConversation.ID;
                }

                string DATA = jsonSerialization.SerializeToString <ProspectClientConversation>(prosClientConv);

                WebClient client = new WebClient();
                client.Headers["Content-type"] = "application/json";
                client.Encoding = Encoding.UTF8;
                string json = client.UploadString(apiurl, DATA);

                if (json != null)
                {
                    var resultObject = jsonSerialization.DeserializeFromString <Result>(json);
                    if (resultObject.IsSuccess)
                    {
                        MessageBox.Show("Record save successfully.", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        this.DialogResult = DialogResult.OK;
                        this.Close();
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to save record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #2
0
        public object GetByProspectClientId(int id)
        {
            IList <ProspectClientConversation> lstProspClient = new List <ProspectClientConversation>();

            DataTable dtAppConfig = DataBase.DBService.ExecuteCommand(string.Format(SELECT_BY_PROSPECTCLIENT_ID, id));

            foreach (DataRow dr in dtAppConfig.Rows)
            {
                ProspectClientConversation prospClientConversation = convertToProspectClientConversationject(dr);
                lstProspClient.Add(prospClientConversation);
            }
            return(lstProspClient);
        }
        private ProspectClientConversation convertSelectedRowDataToConversation()
        {
            ProspectClientConversation prospClinetConv = new ProspectClientConversation();

            if (dataGridConversation.SelectedRows.Count > 0)
            {
                DataRow dr = getSelectedDataRow();
                prospClinetConv.ID = int.Parse(dr.Field <string>("ID"));
                prospClinetConv.ProspectClientId  = int.Parse(dr.Field <string>("ProspectClientId"));
                prospClinetConv.ConversationBy    = dr.Field <string>("ConversationBy");
                prospClinetConv.ConversationDate  = dr.Field <DateTime>("ConversationDate");
                prospClinetConv.Remarks           = dr.Field <string>("Remarks");
                prospClinetConv.UpdatedByUserName = Program.CurrentUser.UserName;
            }
            return(prospClinetConv);
        }
예제 #4
0
        private ProspectClientConversation convertToProspectClientConversationject(DataRow dr)
        {
            ProspectClientConversation prospClientConv = new ProspectClientConversation();

            prospClientConv.ID = dr.Field <int>("ID");
            prospClientConv.ProspectClientId  = dr.Field <int>("ProspectClientId");
            prospClientConv.ConversationDate  = dr.Field <DateTime>("ConversationDate");
            prospClientConv.ConversationBy    = dr.Field <string>("ConversationBy");
            prospClientConv.Remarks           = dr.Field <string>("Remarks");
            prospClientConv.CreatedOn         = dr.Field <DateTime>("CreatedOn");
            prospClientConv.UpdatedOn         = dr.Field <DateTime>("UpdatedOn");
            prospClientConv.UpdatedBy         = dr.Field <int>("UpdatedBy");
            prospClientConv.UpdatedByUserName = dr.Field <string>("UpdatedByUserName");

            return(prospClientConv);
        }
예제 #5
0
 public void DeleteConversation(ProspectClientConversation prospectClientConversation)
 {
     try
     {
         DataBase.DBService.ExecuteCommand(string.Format(DELETE_CONVERSATION_QUERY,
                                                         prospectClientConversation.ID));
         var obj = (ProspectClient) new ProspectClientService().GetById(prospectClientConversation.ProspectClientId);
         Activity.ActivitiesService.Add(ActivityType.DeleteProspectClientConversation, EntryStatus.Success,
                                        Source.Client, prospectClientConversation.UpdatedByUserName, obj.Name, prospectClientConversation.MachineName);
     }
     catch (Exception ex)
     {
         FinancialPlanner.Common.Logger.LogDebug(ex.Message);
         throw ex;
     }
 }
        public Result DeleteConversation(ProspectClientConversation prospectClientConversation)
        {
            var result = new Result();

            try
            {
                ProspectClientConversationService prospClientConvService = new ProspectClientConversationService();
                prospClientConvService.DeleteConversation(prospectClientConversation);
                result.IsSuccess = true;
            }
            catch (Exception exception)
            {
                result.IsSuccess     = false;
                result.ExceptionInfo = exception;
            }

            return(result);
        }
예제 #7
0
        public void AddProspectClientConversation(ProspectClientConversation prospectClientConversation)
        {
            try
            {
                DataBase.DBService.ExecuteCommand(string.Format(INSERT_PROSPECTCLIENTCONVERSATION_QUERY,
                                                                prospectClientConversation.ProspectClientId, prospectClientConversation.ConversationDate.ToString("yyyy-MM-dd hh:mm:ss"), prospectClientConversation.ConversationBy,
                                                                prospectClientConversation.Remarks,
                                                                prospectClientConversation.CreatedOn.ToString("yyyy-MM-dd hh:mm:ss"), prospectClientConversation.CreatedBy,
                                                                prospectClientConversation.UpdatedOn.ToString("yyyy-MM-dd hh:mm:ss"), prospectClientConversation.UpdatedBy));

                var obj = (ProspectClient) new ProspectClientService().GetById(prospectClientConversation.ProspectClientId);

                Activity.ActivitiesService.Add(ActivityType.CreateProspectClientConversation, EntryStatus.Success,
                                               Source.Client, prospectClientConversation.UpdatedByUserName, obj.Name, prospectClientConversation.MachineName);
            }
            catch (Exception ex)
            {
                FinancialPlanner.Common.Logger.LogDebug(ex.Message);
            }
        }
        private void removeRecord(int selectedId)
        {
            try
            {
                FinancialPlanner.Common.JSONSerialization jsonSerialization = new FinancialPlanner.Common.JSONSerialization();
                string apiurl = Program.WebServiceUrl + "/" + DELETE_CONVERSATION_API;

                ProspectClientConversation prosClientConv = new ProspectClientConversation()
                {
                    ID = selectedId,
                    ProspectClientId  = _prospectClient.ID,
                    MachineName       = System.Environment.MachineName,
                    UpdatedByUserName = Program.CurrentUser.UserName
                };

                string DATA = jsonSerialization.SerializeToString <ProspectClientConversation>(prosClientConv);

                WebClient client = new WebClient();
                client.Headers["Content-type"] = "application/json";
                client.Encoding = Encoding.UTF8;
                string json = client.UploadString(apiurl, "DELETE", DATA);

                if (json != null)
                {
                    var resultObject = jsonSerialization.DeserializeFromString <Result>(json);
                    if (resultObject.IsSuccess)
                    {
                        MessageBox.Show("Record deleted successfully.", "Delete", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        DataRow[] dr = _dtConversation.Select("ID =" + selectedId);
                        if (dr.Count() > 0)
                        {
                            dr[0].Delete();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Unable to delete record.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
예제 #9
0
 public frmProspectCustomerConversation(ProspectClient prospectCustomer, int conversationId)
 {
     InitializeComponent();
     _prospCustomer             = prospectCustomer;
     _prospCustomerConversation = _prospCustomer.ProspectClientConversationList.First(i => i.ID == conversationId);
 }