Example #1
0
 protected void FCGrid_OnRowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         int rowIndex = Convert.ToInt32(e.CommandArgument);
         if (e.CommandName == "Edit")
         {
             hdnFCId.Value             = e.CommandArgument.ToString();
             txtCategoryName.Value     = FCGrid.Rows[rowIndex - 1].Cells[1].Text;
             txtCategoryNamedesc.Value = FCGrid.Rows[rowIndex - 1].Cells[2].Text;
             btnsubmit.InnerText       = "Update";
         }
         else if (e.CommandName == "Delete")
         {
             using (FileTrackingContainer container = new FileTrackingContainer())
             {
                 var agentToRemove = container.FileCategories.Find(rowIndex);
                 container.FileCategories.Remove(agentToRemove);
                 container.SaveChanges();
                 Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "toastr.success('Deleted sucessfully');", true);
                 BindData();
             }
         }
     }
     catch (Exception exception)
     {
     }
 }
Example #2
0
        protected void F_OnRowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName == "Edit")
            {
                hdnFileId.Value = e.CommandArgument.ToString();
                //txtname.Value = AgentGrid.Rows[rowIndex - 1].Cells[1].Text;
                //var agentType = AgentGrid.Rows[rowIndex - 1].Cells[2].Text;
                //ddlagenttype.Items[0].Selected = false;
                //ddlagenttype.Items.FindByText(agentType).Selected = true;
                //txtAgentEmployeeName.Value = AgentGrid.Rows[rowIndex - 1].Cells[3].Text;
                //var access = AgentGrid.Rows[rowIndex - 1].Cells[4].Text;
                //ddlagentaccess.Items[0].Selected = false;
                //ddlagentaccess.Items.FindByText(access).Selected = true;
                //txtagentmobile.Value = AgentGrid.Rows[rowIndex - 1].Cells[5].Text;
                //txtemail.Value = AgentGrid.Rows[rowIndex - 1].Cells[6].Text;
                //txtagentscanpref.Value = AgentGrid.Rows[rowIndex - 1].Cells[7].Text;
                //txtagentsec.Value = AgentGrid.Rows[rowIndex - 1].Cells[8].Text;

                btnSubmit.InnerText = "Update";
            }
            else if (e.CommandName == "Delete")
            {
                using (FileTrackingContainer container = new FileTrackingContainer())
                {
                    var agentToRemove = container.FileDatas.Find(rowIndex);
                    container.FileDatas.Remove(agentToRemove);
                    container.SaveChanges();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "toastr.success('Deleted sucessfully');", true);
                    BuildFilesGrid();
                }
            }
        }
Example #3
0
        protected void btn_submit_ServerClick(object sender, EventArgs e)
        {
            if (btn_submit.InnerText == "Submit")
            {
                Status status = new Status
                {
                    StatusName  = txtstatusName.Value,
                    CreatedDate = DateTime.Now,
                    CreatedBy   = 1
                };
                FileTrackingContainer entities = new FileTrackingContainer();
                entities.Status.Add(status);
                entities.SaveChanges();
                Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "toastr.success('Add Status sucessfull');", true);
                resetcontrols();
            }
            else if (btn_submit.InnerText == "Update")
            {
                using (FileTrackingContainer container = new FileTrackingContainer())
                {
                    var id             = int.Parse(hdnFCId.Value);
                    var resultToUpdate =
                        container.Status.SingleOrDefault(item => item.StatusId == id);

                    if (resultToUpdate != null)
                    {
                        resultToUpdate.StatusName   = txtstatusName.Value;
                        resultToUpdate.ModifiedDate = DateTime.Now;
                    }
                    container.SaveChanges();
                    BindData();
                }
            }
        }
Example #4
0
        protected void btnsubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (btnsubmit.InnerText == "Submit")
                {
                    FilePriority filePriorities = new FilePriority
                    {
                        FilePriorityIntervalAlert = string.IsNullOrEmpty(txtintervalAlert.Value) ? 0 : Convert.ToDecimal(txtintervalAlert.Value),
                        FilePriorityIntervalCrit  = string.IsNullOrEmpty(txtPriorityIntervalCrit.Value) ? 0 : Convert.ToDecimal(txtPriorityIntervalCrit.Value),
                        FilePriorityIntervalNotif = string.IsNullOrEmpty(txtintervalNotif.Value) ? 0 : Convert.ToDecimal(txtintervalNotif.Value),
                        FilePriorityName          = txtpriorityname.Value,
                        CreatedBy   = 1,
                        CreatedDate = DateTime.Now
                    };

                    FileTrackingContainer entities = new FileTrackingContainer();
                    entities.FilePriorities.Add(filePriorities);
                    entities.SaveChanges();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), "toastr.success('FilePriority  added sucessfully');", true);
                    BindData();
                }
                else if (btnsubmit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        var id             = int.Parse(hdnFPId.Value);
                        var resultToUpdate =
                            container.FilePriorities.SingleOrDefault(item => item.FilePriorityId == id);

                        if (resultToUpdate != null)
                        {
                            resultToUpdate.FilePriorityName          = txtpriorityname.Value;
                            resultToUpdate.FilePriorityIntervalAlert = Convert.ToDecimal(txtintervalAlert.Value);
                            resultToUpdate.FilePriorityIntervalCrit  = Convert.ToDecimal(txtPriorityIntervalCrit.Value);
                            resultToUpdate.FilePriorityIntervalNotif = Convert.ToDecimal(txtintervalNotif.Value);
                            resultToUpdate.ModifiedBy   = 1;
                            resultToUpdate.ModifiedDate = DateTime.Now;
                        }
                        container.SaveChanges();
                        BindData();
                    }
                }
                ResetControls();
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception);
            }
        }
Example #5
0
        protected void btnsubmit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (btnsubmit.InnerText == "Submit")
                {
                    FileCategory fileCategory = new FileCategory
                    {
                        FileCategoryName        = txtCategoryName.Value,
                        FileCategoryDescription = txtCategoryNamedesc.Value,
                        CreatedDate             = DateTime.Now,
                        CreatedBy = 1
                    };

                    FileTrackingContainer entities = new FileTrackingContainer();
                    entities.FileCategories.Add(fileCategory);
                    entities.SaveChanges();
                    resetcontrols();

                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "toastr.success('FileCategory Added sucessfully');", true);
                    BindData();
                }
                else if (btnsubmit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        var id             = int.Parse(hdnFCId.Value);
                        var resultToUpdate =
                            container.FileCategories.SingleOrDefault(item => item.FileCategoryId == id);

                        if (resultToUpdate != null)
                        {
                            resultToUpdate.FileCategoryDescription = txtCategoryNamedesc.Value;
                            resultToUpdate.FileCategoryName        = txtCategoryName.Value;
                            resultToUpdate.ModifiedBy   = 1;
                            resultToUpdate.ModifiedDate = DateTime.Now;
                        }
                        container.SaveChanges();
                        resetcontrols();
                        BindData();
                    }
                }
            }
            catch (Exception exception)
            {
            }
        }
        protected void btn_submit_ServerClick(object sender, EventArgs e)
        {
            try
            {
                if (btn_submit.InnerText == "Submit")
                {
                    ClientCategory clientCategory = new ClientCategory
                    {
                        Active = true,
                        ClientCategoryDescription = txtclientCategoryNamedesc.Value,
                        ClientCategoryName        = txtclientCategoryName.Value,
                        dateadded = DateTime.Now,
                        UserID    = 1
                    };
                    FileTrackingContainer entities = new FileTrackingContainer();
                    entities.ClientCategories.Add(clientCategory);
                    entities.SaveChanges();
                    ResetCotrols();
                    BindData();
                    Page.ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(),
                                                            "toastr.success('ClientCategory Added Sucessfully');", true);
                }
                else if (btn_submit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        var id             = int.Parse(hdnClientId.Value);
                        var resultToUpdate =
                            container.ClientCategories.SingleOrDefault(item => item.ClientId == id);

                        if (resultToUpdate != null)
                        {
                            resultToUpdate.ClientCategoryDescription = txtclientCategoryNamedesc.Value;
                            resultToUpdate.ClientCategoryName        = txtclientCategoryName.Value;
                            resultToUpdate.dateLastModified          = DateTime.Now;
                        }
                        container.SaveChanges();
                        ResetCotrols();
                        BindData();
                    }
                }
            }
            catch (Exception ex)
            {
            }
        }
Example #7
0
        protected void btnSubmit_OnServerClick(object sender, EventArgs e)
        {
            try
            {
                if (btnSubmit.InnerText == "Submit")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        container.FileDatas.Add(new DAL.FileData
                        {
                            FileId         = fileCode,
                            FileCategoryId =
                                Convert.ToInt32(ddlfilecategory.Items[ddlfilecategory.SelectedIndex].Value),
                            FileCode       = fileCode,
                            FilePriorityId =
                                Convert.ToInt32(ddlfilepriority.Items[ddlfilepriority.SelectedIndex].Value.Split('_')[0]),
                            FileDeliveredOn     = null,
                            FileEntredOn        = null,
                            FileNoExt           = "2",
                            FileNoInt           = "2",
                            CreatedBy           = 1,
                            CreatedDate         = DateTime.Now,
                            AmountApproved      = Convert.ToDecimal(txtamountApproved.Value),
                            AmountMisc          = Convert.ToDecimal(txtamountmisc.Value),
                            AmountProposed      = Convert.ToDecimal(txtamountApproved.Value),
                            ClientId            = Convert.ToInt32(ddlclientname.Items[ddlclientname.SelectedIndex].Value),
                            CmoSection          = txtcmosection.Value,
                            ContactPersonName   = txtcontactpersonname.Value,
                            ContactPersonNumber = Convert.ToInt32(txtcontactpersonnumber.Value),
                            CurrentAgentId      = 3,
                            CurrentStatus       = "Active",
                            FundSource          = "By Hand",
                            FundType            = "Cash"
                        }
                                                );
                        container.SaveChanges();
                        fileCode = "";

                        MailClass.SendMail("", "");
                    }
                }
                else if (btnSubmit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        //var id = int.Parse(AgentId.Value);
                        //var resultToUpdate =
                        //    container.Agents.SingleOrDefault(item => item.AgentId == id);

                        //if (resultToUpdate != null)
                        //{
                        //    resultToUpdate.AgentName = txtname.Value;
                        //    resultToUpdate.AgentTypeID =
                        //        Convert.ToInt32(ddlagenttype.Items[ddlagenttype.SelectedIndex].Value);
                        //    resultToUpdate.AgentEmployeeName = txtAgentEmployeeName.Value;
                        //    resultToUpdate.AgentAccessLevelId =
                        //        Convert.ToInt32(ddlagentaccess.Items[ddlagentaccess.SelectedIndex].Value);
                        //    resultToUpdate.AgentMobile = Convert.ToInt64(txtagentmobile.Value);
                        //    resultToUpdate.AgentEmail = txtemail.Value;
                        //    resultToUpdate.AgentScanPref = txtagentscanpref.Value;
                        //    resultToUpdate.AgentSection = txtagentsec.Value;
                        //    resultToUpdate.ModifiedBy = 1;
                        //    resultToUpdate.ModifiedDate = DateTime.Now;

                        //}

                        container.SaveChanges();
                    }
                }
                BuildFilesGrid();
            }
            catch (Exception exception)
            {
            }
        }
Example #8
0
        protected void btn_addagent_Click(object sender, EventArgs e)
        {
            try
            {
                if (btnSubmit.InnerText == "Submit")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        container.Agents.Add(new DAL.Agent
                        {
                            AgentName          = txtname.Value,
                            AgentTypeID        = Convert.ToInt32(ddlagenttype.Items[ddlagenttype.SelectedIndex].Value),
                            AgentEmployeeName  = txtAgentEmployeeName.Value,
                            AgentAccessLevelId = Convert.ToInt32(ddlagentaccess.Items[ddlagentaccess.SelectedIndex].Value),
                            AgentMobile        = Convert.ToInt64(txtagentmobile.Value),
                            AgentEmail         = txtemail.Value,
                            AgentScanPref      = txtagentscanpref.Value,
                            AgentSection       = txtagentsec.Value,
                            CreatedBy          = 1,
                            CreatedDate        = DateTime.Now
                        }
                                             );
                        container.SaveChanges();
                    }
                }
                else if (btnSubmit.InnerText == "Update")
                {
                    using (FileTrackingContainer container = new FileTrackingContainer())
                    {
                        var id             = int.Parse(AgentId.Value);
                        var resultToUpdate =
                            container.Agents.SingleOrDefault(item => item.AgentId == id);

                        if (resultToUpdate != null)
                        {
                            resultToUpdate.AgentName   = txtname.Value;
                            resultToUpdate.AgentTypeID =
                                Convert.ToInt32(ddlagenttype.Items[ddlagenttype.SelectedIndex].Value);
                            resultToUpdate.AgentEmployeeName  = txtAgentEmployeeName.Value;
                            resultToUpdate.AgentAccessLevelId =
                                Convert.ToInt32(ddlagentaccess.Items[ddlagentaccess.SelectedIndex].Value);
                            resultToUpdate.AgentMobile   = Convert.ToInt64(txtagentmobile.Value);
                            resultToUpdate.AgentEmail    = txtemail.Value;
                            resultToUpdate.AgentScanPref = txtagentscanpref.Value;
                            resultToUpdate.AgentSection  = txtagentsec.Value;
                            resultToUpdate.ModifiedBy    = 1;
                            resultToUpdate.ModifiedDate  = DateTime.Now;
                        }

                        container.SaveChanges();
                    }
                }

                //clear values
                txtname.Value = string.Empty;
                ddlagenttype.SelectedIndex   = 0;
                txtAgentEmployeeName.Value   = string.Empty;
                ddlagentaccess.SelectedIndex = 0;
                txtagentmobile.Value         = string.Empty;
                txtemail.Value         = string.Empty;
                txtagentscanpref.Value = string.Empty;
                txtagentsec.Value      = string.Empty;
                BindAgentsData();
            }
            catch (Exception exception)
            {
            }
        }