void DeleteItem(int itemid)
        {
            DAL.ServiceTemplateCrmEvolutionDetailItem item = DAL.ServiceTemplateCrmEvolutionDetail.Get(ctx, itemid);
            bool succeded = DAL.ServiceTemplateCrmEvolutionDetail.Delete(ctx, item);

            rgvData.Rebind();
        }
        bool Save()
        {
            if (!IsValid())
            {
                return(false);
            }

            DateTime currentdate = DateTime.Now;

            var item = new DAL.ServiceTemplateCrmEvolutionDetailItem();

            item.ServiceTemplateCrmEvolutionId = Convert.ToInt32(GetTemplateId());
            item.Code             = txtCode.Text;
            item.Name             = txtName.Text;
            item.Description      = txtDescription.Text;
            item.Command          = txtCommand.Text;
            item.CommandType      = txtCommandType.Text;
            item.DestinationTable = txtDestinationTable.Text;
            item.Sequence         = Convert.ToInt32(txtSequence.Text);
            item.ModifiedOn       = DateTime.Now;
            item.LastModifiedAdministratorAccountId = Convert.ToInt32(Helper.Current.AdministratorAccoundId());
            item.SourceTable = txtSourceTable.Text;
            item.IsActive    = chkActive.Checked;


            bool succeeded = DAL.ServiceTemplateCrmEvolutionDetail.Save(ctx, item);

            return(succeeded);
        }
        protected void btnUpdate_Click(object sender, EventArgs e)
        {
            if (isValid())
            {
                DAL.ServiceTemplateCrmEvolutionDetailItem item = new DAL.ServiceTemplateCrmEvolutionDetailItem();

                //   item.CreatedBy = DAL.AdministratorAccount.GetCurrentAdministrator(ctx).Id;
                //  item.CreatedOn = DateTime.Now;

                if (id != null)
                {
                    item = DAL.ServiceTemplateCrmEvolutionDetail.Get(ctx, (Int32)id);
                }

                item.IsActive = chkActive.Checked;

                item.Name    = txtName.Text;
                item.Command = txtCommand.Text;
                item.ServiceTemplateCrmEvolutionId = Convert.ToInt32(servicetemplateid);
                item.Sequence = Convert.ToInt32(txtSequence.Text);
                //     item.ModifiedBy = DAL.AdministratorAccount.GetCurrentAdministrator(ctx).Id;
                item.ModifiedOn       = DateTime.Now;
                item.CommandType      = txtCommandType.Text;
                item.Description      = txtDescription.Text;
                item.DestinationTable = txtDestinationTable.Text;
                item.SourceTable      = txtSourceTable.Text;
                item.Code             = txtCode.Text;



                DAL.ServiceTemplateCrmEvolutionDetail.Save(ctx, item);

                Response.Redirect("ServiceTemplateDetailList.aspx?id=" + servicetemplateid);
            }
        }
        void LoadData()
        {
            string id = GetId();

            DAL.ServiceTemplateCrmEvolutionDetailItem item = DAL.ServiceTemplateCrmEvolutionDetail.Get(ctx, Convert.ToInt32(id));

            if (item != null)
            {
                txtId.Text               = item.Id.ToString();
                txtCode.Text             = item.Code;
                txtName.Text             = item.Name;
                txtDescription.Text      = item.Description;
                txtCommand.Text          = item.Command;
                txtCommandType.Text      = item.CommandType;
                txtDestinationTable.Text = item.DestinationTable;
                txtSequence.Text         = item.Sequence.ToString();
                txtSourceTable.Text      = item.SourceTable;

                DAL.AdministratorAccountItem aia = DAL.AdministratorAccount.Get(ctx, Convert.ToInt32(item.LastModifiedAdministratorAccountId));
                if (aia != null)
                {
                    txtLastModifiedAministratorAccount.Text = aia.FirstName + " " + aia.LastName + " ( " + aia.Email + " )";
                }

                txtLastModifiedOn.Text = Convert.ToDateTime(item.ModifiedOn).ToShortDateString() + " " + Convert.ToDateTime(item.ModifiedOn).ToShortTimeString();

                txtActive.Text = (item.IsActive) ? "Yes" : "No";
            }
        }
        void LoadData()
        {
            if (id != null)
            {
                txtId.Enabled = false;

                DAL.ServiceTemplateCrmEvolutionDetailItem item = DAL.ServiceTemplateCrmEvolutionDetail.Get(ctx, (Int32)id);


                txtId.Text               = item.Id.ToString();
                txtName.Text             = item.Name;
                txtCommand.Text          = item.Command;
                txtSequence.Text         = item.Sequence.ToString();
                chkActive.Checked        = item.IsActive;
                txtCommandType.Text      = item.CommandType;
                txtDescription.Text      = item.Description;
                txtDestinationTable.Text = item.DestinationTable;
                txtSourceTable.Text      = item.SourceTable;
                txtCode.Text             = item.Code;
            }
        }
        void LoadData()
        {
            string id = (Request.QueryString["id"] != null && !string.IsNullOrEmpty(Request.QueryString["id"])) ? Request.QueryString["id"].ToString() : null;

            DAL.ServiceTemplateCrmEvolutionDetailItem item = DAL.ServiceTemplateCrmEvolutionDetail.Get(ctx, Convert.ToInt32(id));

            if (item != null)
            {
                txtId.Text          = item.Id.ToString();
                txtCode.Text        = item.Code;
                txtName.Text        = item.Name;
                txtDescription.Text = item.Description;

                txtCommand.Text          = item.Command;
                txtCommandType.Text      = item.CommandType;
                txtDestinationTable.Text = item.DestinationTable;
                txtSequence.Text         = item.Sequence.ToString();

                txtSourceTable.Text = item.SourceTable;
                item.IsActive       = chkActive.Checked;
            }
        }