コード例 #1
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_role = Role(item.GetDataKeyValue("ID"));

            if (!m_role.UpdateName(String(values["Name"])))
            {
                e.Canceled = true;
                DisplayError("Failed to update the role name.", m_lblError);
            }
            else
            {
                Repeater repeater = e.Item.FindControl("m_rpTaskList") as Repeater;

                foreach (RepeaterItem rItem in repeater.Items)
                {
                    CheckBox chkTask = rItem.FindControl("m_chkTask") as CheckBox;

                    if (chkTask.Checked)
                    {
                        var btnDelete = rItem.FindControl("m_btnDelete") as LinkButton;
                        var task      = Task(btnDelete.CommandArgument);
                        m_role.AddTask(task);
                    }
                }
            }
        }
コード例 #2
0
    protected void rdgCarreras_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashtable = new Hashtable();
            career           objCareer    = new career();

            ObjItem.ExtractValues(ObjHashtable);

            objCareer.id = Convert.ToInt32(ObjHashtable["id"]);

            clsCarrera carrera = new clsCarrera();
            carrera.prCarrera = objCareer;

            strResultado = carrera.EliminarCarrera();

            if (string.IsNullOrEmpty(strResultado))
            {
                rdgCarreras.Rebind();
                base.EnvioMensaje("Registro eliminado correctamente.", 2, Manejador);
            }
            else
            {
                rdgCarreras.Rebind();
                base.EnvioMensaje(strResultado, 1, Manejador);
            }
        }
        catch (Exception ex)
        {
            base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador);
        }
    }
コード例 #3
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity      = Entity(m_cboEntities.SelectedValue);
            m_employee            = Employee(m_cboEmployees.SelectedValue, m_businessEntity);
            m_attendanceException = AttendanceException(item.GetDataKeyValue("ID"), m_employee);

            m_start = DateTime(values["Start"]);
            m_end   = DateTime(values["End"]);

            var exceptionTypeID = Int((e.Item.FindControl("m_cboExceptionTypes") as RadComboBox).SelectedValue);

            m_attendanceExceptionType = AttendanceExceptionType(exceptionTypeID);

            var approved = Bool((e.Item.FindControl("m_chkApproved") as CheckBox).Checked);

            if (!m_attendanceException.UpdateDetails(String(values["Remarks"]), m_start, m_end, approved))
            {
                e.Canceled = true;
                DisplayError("Failed to update entry details.", m_lblError);
            }
        }
コード例 #4
0
    protected void rdgUsuarios_DeleteCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashtable = new Hashtable();
            usuario          objUsuario   = new usuario();

            ObjItem.ExtractValues(ObjHashtable);

            objUsuario.id = Convert.ToInt32(ObjHashtable["id"]);

            clsUsuarios usuario = new clsUsuarios();
            usuario.prUsuario = objUsuario;

            strResultado = usuario.EliminarUsuario();

            if (string.IsNullOrEmpty(strResultado))
            {
                this.rdgUsuarios.Rebind();
                base.EnvioMensaje("Registro eliminado correctamente.", 2, Manejador);
            }
            else
            {
                rdgUsuarios.Rebind();
                base.EnvioMensaje(strResultado, 1, Manejador);
            }
        }
        catch (Exception ex)
        {
            base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador);
        }
    }
コード例 #5
0
        protected void grvNhomChucDanh_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            switch (e.Item.OwnerTableView.Name)
            {
            case "tbl_NhomChucDanh":
                NhomChucDanh nhomchucdanh = new NhomChucDanh();
                nhomchucdanh.NgayTao  = nhomchucdanh.NgayCapNhat = DateTime.Now;
                nhomchucdanh.NguoiTao = nhomchucdanh.NguoiCapNhat = idNhanVien;
                item.UpdateValues(nhomchucdanh);
                _entities.AddToNhomChucDanhs(nhomchucdanh);
                _entities.SaveChanges();
                break;

            case "tbl_ChucDanhChuyenMon":
                ChucDanh chucdanh = new ChucDanh();
                item.UpdateValues(chucdanh);
                GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
                if (parentItem != null)
                {
                    var idNhomChucDanh = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["IDNhomChucDanh"].ToString();
                    chucdanh.IDNhomChucDanh = Convert.ToInt32(idNhomChucDanh);
                    chucdanh.NgayTao        = chucdanh.NgayCapNhat = DateTime.Now;
                    chucdanh.NguoiTao       = chucdanh.NguoiCapNhat = idNhanVien;
                    _entities.AddToChucDanhs(chucdanh);
                    _entities.SaveChanges();
                }
                break;
            }
        }
コード例 #6
0
    protected void rdgCursos_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            string                     strResultado = string.Empty;
            GridEditableItem           ObjItem      = (GridEditableItem)e.Item;
            Hashtable                  ObjHashtable = new Hashtable();
            teacher_course_assignement objAsign     = new teacher_course_assignement();

            ObjItem.ExtractValues(ObjHashtable);

            objAsign.id_assign = Convert.ToInt32(ObjHashtable["id_assign"]);

            clsAsign asignacion = new clsAsign();
            asignacion.prAsignacion = objAsign;

            strResultado = asignacion.EliminarAsignacion();

            if (string.IsNullOrEmpty(strResultado))
            {
                this.rdgCursos.Rebind();
                base.EnvioMensaje("Registro eliminado correctamente.", 2, Manejador);
            }
            else
            {
                this.rdgCursos.Rebind();
                base.EnvioMensaje(strResultado, 1, Manejador);
            }
        }
        catch (Exception ex)
        {
            base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador);
        }
    }
コード例 #7
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);

            m_shiftPunchInStart  = DateTime(values["PunchInStartTime"]);
            m_shiftStart         = DateTime(values["StartTime"]);
            m_shiftPunchInEnd    = DateTime(values["PunchInEndTime"]);
            m_shiftPunchOutStart = DateTime(values["PunchOutStartTime"]);
            m_shiftEnd           = DateTime(values["EndTime"]);
            m_shiftPunchOutEnd   = DateTime(values["PunchOutEndTime"]);

            m_shiftStart = new DateTime(m_shiftPunchInStart.Year, m_shiftPunchInStart.Month, m_shiftPunchInStart.Day, m_shiftStart.Hour, m_shiftStart.Minute, m_shiftStart.Second, m_shiftStart.Millisecond);

            if (m_shiftStart < m_shiftPunchInStart)
            {
                m_shiftStart = m_shiftStart.AddDays(1);
            }

            m_shiftPunchInEnd = new DateTime(m_shiftStart.Year, m_shiftStart.Month, m_shiftStart.Day, m_shiftPunchInEnd.Hour, m_shiftPunchInEnd.Minute, m_shiftPunchInEnd.Second, m_shiftPunchInEnd.Millisecond);

            if (m_shiftPunchInEnd < m_shiftStart)
            {
                m_shiftPunchInEnd = m_shiftPunchInEnd.AddDays(1);
            }

            m_shiftPunchOutStart = new DateTime(m_shiftPunchInEnd.Year, m_shiftPunchInEnd.Month, m_shiftPunchInEnd.Day, m_shiftPunchOutStart.Hour, m_shiftPunchOutStart.Minute, m_shiftPunchOutStart.Second, m_shiftPunchOutStart.Millisecond);

            if (m_shiftPunchOutStart < m_shiftPunchInEnd)
            {
                m_shiftPunchOutStart = m_shiftPunchOutStart.AddDays(1);
            }

            m_shiftEnd = new DateTime(m_shiftPunchOutStart.Year, m_shiftPunchOutStart.Month, m_shiftPunchOutStart.Day, m_shiftEnd.Hour, m_shiftEnd.Minute, m_shiftEnd.Second, m_shiftEnd.Millisecond);

            if (m_shiftEnd < m_shiftPunchOutStart)
            {
                m_shiftEnd = m_shiftEnd.AddDays(1);
            }

            m_shiftPunchOutEnd = new DateTime(m_shiftEnd.Year, m_shiftEnd.Month, m_shiftEnd.Day, m_shiftPunchOutEnd.Hour, m_shiftPunchOutEnd.Minute, m_shiftPunchOutEnd.Second, m_shiftPunchOutEnd.Millisecond);

            if (m_shiftPunchOutEnd < m_shiftEnd)
            {
                m_shiftPunchOutEnd = m_shiftPunchOutEnd.AddDays(1);
            }

            if (!m_businessEntity.AddShift(String(values["Name"]),
                                           m_shiftStart, m_shiftEnd,
                                           m_shiftPunchInStart, m_shiftPunchInEnd,
                                           m_shiftPunchOutStart, m_shiftPunchOutEnd))
            {
                e.Canceled = true;
                DisplayError("Failed to add shift.", m_lblError);
            }
        }
コード例 #8
0
        protected void grvNgach_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            switch (e.Item.OwnerTableView.Name)
            {
            case "tbl_Ngach":
                Ngach ngach = new Ngach();
                ngach.NgayTao  = ngach.NgayCapNhat = DateTime.Now;
                ngach.NguoiTao = ngach.NguoiCapNhat = idNhanVien;
                item.UpdateValues(ngach);
                _entities.AddToNgaches(ngach);
                _entities.SaveChanges();
                break;

            case "tbl_BacNgach":
                BacNgach bacngach = new BacNgach();
                item.UpdateValues(bacngach);
                GridDataItem parentItem = e.Item.OwnerTableView.ParentItem;
                if (parentItem != null)
                {
                    var idNgach = parentItem.OwnerTableView.DataKeyValues[parentItem.ItemIndex]["IDNgach"].ToString();
                    bacngach.IDNgach  = Convert.ToInt32(idNgach);
                    bacngach.NgayTao  = bacngach.NgayCapNhat = DateTime.Now;
                    bacngach.NguoiTao = bacngach.NguoiCapNhat = idNhanVien;
                    _entities.AddToBacNgaches(bacngach);
                    _entities.SaveChanges();
                }
                break;
            }
        }
コード例 #9
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = BusinessEntity.Find(Int(item.GetDataKeyValue("ID")));
            var txtName = e.Item.FindControl("m_txtCompName") as TextBox;

            if (!m_businessEntity.UpdateName(txtName.Text))
            {
                e.Canceled = true;
                DisplayError("Failed to update the company name.", m_lblError);
            }

            Repeater repeater = e.Item.FindControl("m_rpCompanyContactInfo") as Repeater;

            foreach (RepeaterItem rItem in repeater.Items)
            {
                var txtValue      = rItem.FindControl("m_txtData") as TextBox;
                var btnDelete     = rItem.FindControl("m_btnDelete") as LinkButton;
                var contactDetail = ContactDetail(btnDelete.CommandArgument, m_businessEntity);

                if (!contactDetail.UpdateValue(txtValue.Text))
                {
                    e.Canceled = true;
                    DisplayError("Failed to update the one or more contact information.", m_lblError);
                }
            }
        }
コード例 #10
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);
            m_shift          = Shift(m_cboShifts.SelectedValue, m_businessEntity);

            m_shiftStart = DateTime(values["StartTime"]);
            m_shiftEnd   = DateTime(values["EndTime"]);
            m_shiftEnd   = new DateTime(m_shiftStart.Year, m_shiftStart.Month, m_shiftStart.Day, m_shiftEnd.Hour, m_shiftEnd.Minute, m_shiftEnd.Second, m_shiftEnd.Millisecond);

            if (m_shiftEnd < m_shiftStart)
            {
                m_shiftEnd = m_shiftEnd.AddDays(1);
            }

            var exceptionTypeID = Int((e.Item.FindControl("m_cboExceptionTypes") as RadComboBox).SelectedValue);

            m_shiftExceptionType = ShiftExceptionType(exceptionTypeID);

            var       weekDayName = String((e.Item.FindControl("m_cboWeekDays") as RadComboBox).SelectedValue);
            DayOfWeek?weekDay     = string.IsNullOrEmpty(weekDayName) ? (DayOfWeek?)null : (DayOfWeek)Enum.Parse(typeof(DayOfWeek), weekDayName);

            if (!m_shift.AddException(m_shiftStart, m_shiftEnd, weekDay, m_shiftExceptionType))
            {
                e.Canceled = true;
                DisplayError("Failed to add shift exception.", m_lblError);
            }
        }
コード例 #11
0
    protected void rdgIns_DeleteCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            string            strResultado = string.Empty;
            GridEditableItem  ObjItem      = (GridEditableItem)e.Item;
            Hashtable         ObjHashtable = new Hashtable();
            incription_course objIns       = new incription_course();

            ObjItem.ExtractValues(ObjHashtable);

            objIns.id = Convert.ToInt32(ObjHashtable["id"]);

            clsInscripcion asignacion = new clsInscripcion();
            asignacion.prInscripcion = objIns;

            strResultado = asignacion.EliminarAsignacion();

            if (string.IsNullOrEmpty(strResultado))
            {
                this.rdgIns.Rebind();
                base.EnvioMensaje("Inscripción eliminada correctamente.", 2, Manejador);
            }
            else
            {
                this.rdgIns.Rebind();
                base.EnvioMensaje(strResultado, 1, Manejador);
            }
        }
        catch (Exception ex)
        {
            base.EnvioMensaje("Error al eliminar datos.", 1, this.Manejador);
        }
    }
コード例 #12
0
    protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashTable = new Hashtable();
            usuario          objUsuario   = new usuario();

            ObjItem.ExtractValues(ObjHashTable);

            objUsuario.id            = Convert.ToInt32(ObjHashTable["id"]);
            objUsuario.complete_name = IsNull(ObjHashTable["complete_name"]) ? "" : ObjHashTable["complete_name"].ToString();
            objUsuario.dpi           = IsNull(ObjHashTable["dpi"]) ? 0 : Convert.ToInt64(ObjHashTable["dpi"]);
            objUsuario.email         = IsNull(ObjHashTable["email"]) ? "" : ObjHashTable["email"].ToString();
            objUsuario.address       = IsNull(ObjHashTable["address"]) ? "" : ObjHashTable["address"].ToString();
            objUsuario.phone         = IsNull(ObjHashTable["phone"]) ? 0 : Convert.ToInt32(ObjHashTable["phone"]);
            objUsuario.cell_phone    = IsNull(ObjHashTable["cell_phone"]) ? 0 : Convert.ToInt32(ObjHashTable["cell_phone"]);

            if (objUsuario.phone == 0)
            {
                objUsuario.phone = null;
            }
            if (objUsuario.cell_phone == 0)
            {
                objUsuario.cell_phone = null;
            }

            strResultado = ReglasNegocio(objUsuario);

            if (strResultado.Equals(string.Empty))
            {
                clsUsuarios usuario = new clsUsuarios();
                usuario.prUsuario = objUsuario;

                strResultado = usuario.EditarUsuario();

                if (strResultado.Equals(string.Empty))
                {
                    base.EnvioMensaje("Datos actualizados correctamente.", 2, this.Manejador);
                    this.rdgUsuarios.Rebind();
                }
                else
                {
                    base.EnvioMensaje(strResultado, 2, this.Manejador);
                }
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        catch (Exception ex)
        {
            this.rdgUsuarios.MasterTableView.ClearEditItems();
            base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador);
        }
    }
コード例 #13
0
        protected void gvCustomUrls_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;

            DropDownList ddlPortalAliasId    = editedItem.FindControl("ddlPortalAliasId") as DropDownList;
            DropDownList ddlPortalAliasUsage = editedItem.FindControl("ddlPortalAliasUsage") as DropDownList;
            DropDownList ddlHttpStatus       = editedItem.FindControl("ddlHttpStatus") as DropDownList;

            Hashtable ht = new Hashtable();

            editedItem.ExtractValues(ht);

            // increment existing tabUrls
            List <TabUrlInfo> tabUrls = DotNetNuke.Entities.Tabs.Internal.TestableTabController.Instance.GetTabUrls(ddlPage.SelectedItemValueAsInt, PortalId);

            foreach (TabUrlInfo tu in tabUrls)
            {
                tu.SeqNum++;
                DotNetNuke.Entities.Tabs.Internal.TestableTabController.Instance.SaveTabUrl(tu, PortalId, false);
            }

            // create new tabUrl
            TabUrlInfo tabUrl = new TabUrlInfo();

            tabUrl.TabId       = ddlPage.SelectedItemValueAsInt;
            tabUrl.SeqNum      = 0;
            tabUrl.CultureCode = this.PortalSettings.CultureCode;
            if (!string.IsNullOrEmpty(ddlPortalAliasId.SelectedValue))
            {
                tabUrl.PortalAliasId = int.Parse(ddlPortalAliasId.SelectedValue);
            }

            if (!string.IsNullOrWhiteSpace(ddlPortalAliasUsage.SelectedValue))
            {
                tabUrl.PortalAliasUsage = (PortalAliasUsageType)Enum.Parse(typeof(PortalAliasUsageType), ddlPortalAliasUsage.SelectedValue);
            }

            if (ht["Url"] != null)
            {
                tabUrl.Url = FriendlyUrlController.EnsureLeadingChar("/", ht["Url"].ToString());
            }
            if (ht["QueryString"] != null)
            {
                tabUrl.QueryString = ht["QueryString"].ToString();
            }
            tabUrl.HttpStatus = ddlHttpStatus.SelectedValue;
            tabUrl.IsSystem   = false;

            DotNetNuke.Entities.Tabs.Internal.TestableTabController.Instance.SaveTabUrl(tabUrl, PortalId, true);
            DotNetNuke.Common.Utilities.DataCache.ClearCache();
        }
コード例 #14
0
        protected void grvTonGiao_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            TonGiao tg = new TonGiao();

            tg.NgayTao  = tg.NgayCapNhat = DateTime.Now;
            tg.NguoiTao = tg.NguoiCapNhat = idNhanVien;
            item.UpdateValues(tg);
            _entities.AddToTonGiaos(tg);
            _entities.SaveChanges();
        }
コード例 #15
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);

            if (!CoreLib.EmployeeType.Add(String(values["Name"])))
            {
                e.Canceled = true;
                DisplayError("Failed to add employee type.", m_lblError);
            }
        }
コード例 #16
0
        protected void grvDanTocs_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            DanToc dt = new DanToc();

            dt.NguoiTao = dt.NguoiCapNhat = idNhanVien;
            dt.NgayTao  = dt.NgayCapNhat = DateTime.Now;
            item.UpdateValues(dt);
            _entities.AddToDanTocs(dt);
            _entities.SaveChanges();
        }
コード例 #17
0
        protected void grvLoaiHinhDT_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            LoaiHinhDT lh = new LoaiHinhDT();

            lh.NgayTao  = lh.NgayCapNhat = DateTime.Now;
            lh.NguoiTao = lh.NguoiCapNhat = idNhanVien;
            item.UpdateValues(lh);
            _entities.AddToLoaiHinhDTs(lh);
            _entities.SaveChanges();
        }
コード例 #18
0
        protected void grvChucDanhCongViec_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            ChucDanhCongViec obj = new ChucDanhCongViec();

            obj.NgayTao  = obj.NgayCapNhat = DateTime.Now;
            obj.NguoiTao = obj.NguoiCapNhat = idNhanVien;
            item.UpdateValues(obj);
            _entities.AddToChucDanhCongViecs(obj);
            _entities.SaveChanges();
        }
コード例 #19
0
        protected void grvQHNhanThan_InsertCommand(object sender, GridCommandEventArgs e)
        {
            GridEditableItem item   = e.Item as GridEditableItem;
            Hashtable        values = new Hashtable();

            item.ExtractValues(values);
            QuanHe tt = new QuanHe();

            tt.NgayTao  = tt.NgayCapNhat = DateTime.Now;
            tt.NguoiTao = tt.NguoiCapNhat = idNhanVien;
            item.UpdateValues(tt);
            _entities.AddToQuanHes(tt);
            _entities.SaveChanges();
        }
コード例 #20
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);

            if (!CoreLib.BusinessEntity.Add(String(values["Name"]), m_businessEntity, BusinessEntityType.Branch))
            {
                e.Canceled = true;
                DisplayError("Failed to add branch.", m_lblError);
            }
        }
コード例 #21
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            var txtName = e.Item.FindControl("m_txtCompName") as TextBox;

            if (!CoreLib.BusinessEntity.Add(txtName.Text, null, BusinessEntityType.Company))
            {
                e.Canceled = true;
                DisplayError("Failed to add company.", m_lblError);
            }
        }
コード例 #22
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);

            if (!m_businessEntity.AddHoliday(String(values["Name"]), DateTime(values["Start"]), DateTime(values["End"])))
            {
                e.Canceled = true;
                DisplayError("Failed to add holiday.", m_lblError);
            }
        }
コード例 #23
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_profileField = ProfileField(item.GetDataKeyValue("ID"), CoreLib.Profile.Contact);

            if (!m_profileField.UpdateName(String(values["Name"])))
            {
                e.Canceled = true;
                DisplayError("Failed to update the contact field name.", m_lblError);
            }
        }
コード例 #24
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_employeeType = EmployeeType(item.GetDataKeyValue("ID"));

            if (!m_employeeType.UpdateName(String(values["Name"])))
            {
                e.Canceled = true;
                DisplayError("Failed to update the employee type.", m_lblError);
            }
        }
コード例 #25
0
        protected void m_dgvGrid_UpdateCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);
            m_holiday        = Holiday(item.GetDataKeyValue("ID"), m_businessEntity);

            if (!m_holiday.UpdateDetails(String(values["Name"]), DateTime(values["Start"]), DateTime(values["End"])))
            {
                e.Canceled = true;
                DisplayError("Failed to update the holiday details.", m_lblError);
            }
        }
コード例 #26
0
        protected void m_dgvGrid_InsertCommand(object source, GridCommandEventArgs e)
        {
            DisplayError("", m_lblError);
            Hashtable        values = new Hashtable();
            GridEditableItem item   = e.Item as GridEditableItem;

            item.ExtractValues(values);
            m_businessEntity = Entity(m_cboEntities.SelectedValue);
            m_joiningDate    = DateTime(values["JoiningDate"]);
            var departmentID   = Int((e.Item.FindControl("m_cboDepartments") as RadComboBox).SelectedValue);
            var designationID  = Int((e.Item.FindControl("m_cboDesignations") as RadComboBox).SelectedValue);
            var employeeTypeID = Int((e.Item.FindControl("m_cboEmployeeTypes") as RadComboBox).SelectedValue);
            var roleID         = Int((e.Item.FindControl("m_cboRoles") as RadComboBox).SelectedValue);

            m_role         = Role(roleID);
            m_department   = Department(departmentID);
            m_designation  = Designation(designationID);
            m_employeeType = EmployeeType(employeeTypeID);
            var    buttonList = e.Item.FindControl("m_rblTypes") as RadioButtonList;
            Gender gender     = (Gender)Enum.Parse(typeof(Gender), buttonList.SelectedValue);

            var success = m_businessEntity.AddEmployee(String(values["Code"]), gender,
                                                       String(values["FirstName"]), String(values["MiddleName"]), String(values["LastName"]),
                                                       m_joiningDate,
                                                       m_department, m_designation, m_employeeType);

            if (!success)
            {
                e.Canceled = true;
                DisplayError("Failed to add employee.", m_lblError);
            }

            if (success)
            {
                m_employee = m_businessEntity.FindEmployee(String(values["Code"]));

                if (!string.IsNullOrEmpty(String(values["Login"])) && m_role != null)
                {
                    if (!m_employee.AssignLogin(String(values["Login"]), String(values["Login"]), m_role))
                    {
                        e.Canceled = true;
                        DisplayError("Failed to assign role to employee.", m_lblError);
                    }
                }
            }
        }
コード例 #27
0
    private void DoUpdateAction(GridEditableItem item)
    {
        ConversionUtils conversionUtils = new ConversionUtils();

        int       idCurrency = 0;
        Hashtable newValues  = new Hashtable();

        //Extract the values entered by the user
        item.ExtractValues(newValues);
        //If the new value is null, convert it to the empty string to avoid multiple null checks
        if (newValues["BudgetExchangeRate"] == null)
        {
            newValues["BudgetExchangeRate"] = String.Empty;
        }

        ArrayList errors = new ArrayList();
        decimal   rate   = 0;

        //Check if the update hour is of decimal type
        if (!String.IsNullOrEmpty(newValues["BudgetExchangeRate"].ToString()) && decimal.TryParse(newValues["BudgetExchangeRate"].ToString(), out rate) == false)
        {
            errors.Add(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_FIELD_NOT_NUMERIC, "Budget Exchange Rate"));
        }
        if (String.IsNullOrEmpty(newValues["BudgetExchangeRate"].ToString()))
        {
            errors.Add(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_FIELD_CANNOT_BE_EMPTY, "Budget Exchange Rate"));
        }
        if (rate < 0)
        {
            errors.Add(ApplicationMessages.MessageWithParameters(ApplicationMessages.EXCEPTION_FIELD_MUST_BE_POSITIVE, "Budget Exchange Rate"));
        }
        string temp = item.GetDataKeyValue("IdCurrency").ToString();

        if (string.IsNullOrEmpty(temp) || !int.TryParse(temp, out idCurrency))
        {
            errors.Add(ApplicationMessages.MessageWithParameters("IdCurrency is missing", "Budget Exchange Rate"));
        }

        //If there are errors the update shouldn't be done
        if (errors.Count != 0)
        {
            throw new IndException(errors);
        }

        UpdateBudgetExchangeRate(idCurrency, rate);
    }
コード例 #28
0
    protected void rdgNotas_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            string            strResultado = string.Empty;
            GridEditableItem  ObjItem      = (GridEditableItem)e.Item;
            Hashtable         ObjHashTable = new Hashtable();
            incription_course objIns       = new incription_course();

            ObjItem.ExtractValues(ObjHashTable);

            objIns.id          = Convert.ToInt32(ObjHashTable["id"]);
            objIns.note        = IsNull(ObjHashTable["nota"]) ? -1 : Convert.ToInt32(ObjHashTable["nota"]);
            objIns.observation = IsNull(ObjHashTable["observacion"]) ? "" : ObjHashTable["observacion"].ToString();
            objIns.id_state    = IsNull(ObjHashTable["estado"]) ? 1 : Convert.ToInt32(ObjHashTable["estado"].ToString());

            strResultado = ReglasNegocio(objIns);

            if (strResultado.Equals(string.Empty))
            {
                clsNotas notas = new clsNotas();
                notas.prInscripcion = objIns;

                strResultado = notas.ActualizarNota();

                if (strResultado.Equals(string.Empty))
                {
                    base.EnvioMensaje("Nota actualizada correctamente.", 2, this.Manejador);
                    this.rdgNotas.Rebind();
                }
                else
                {
                    base.EnvioMensaje(strResultado, 2, this.Manejador);
                }
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        catch (Exception ex)
        {
            this.rdgNotas.MasterTableView.ClearEditItems();
            base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador);
        }
    }
コード例 #29
0
    protected void rdgCarreras_UpdateCommand(object sender, GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashTable = new Hashtable();
            career           objCareer    = new career();

            ObjItem.ExtractValues(ObjHashTable);

            objCareer.id          = Convert.ToInt32(ObjHashTable["id"]);
            objCareer.name        = IsNull(ObjHashTable["name"]) ? "" : ObjHashTable["name"].ToString();
            objCareer.description = IsNull(ObjHashTable["description"]) ? "" : ObjHashTable["description"].ToString();

            strResultado = ReglasNegocio(objCareer);

            if (strResultado.Equals(string.Empty))
            {
                clsCarrera carrera = new clsCarrera();
                carrera.prCarrera = objCareer;

                strResultado = carrera.EditarCarrera();

                if (strResultado.Equals(string.Empty))
                {
                    base.EnvioMensaje("Datos actualizados correctamente.", 2, this.Manejador);
                    this.rdgCarreras.Rebind();
                }
                else
                {
                    base.EnvioMensaje(strResultado, 2, this.Manejador);
                }
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        catch (Exception ex)
        {
            this.rdgCarreras.MasterTableView.ClearEditItems();
            base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador);
        }
    }
コード例 #30
0
    protected void rdgCursos_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
    {
        try
        {
            string           strResultado = string.Empty;
            GridEditableItem ObjItem      = (GridEditableItem)e.Item;
            Hashtable        ObjHashTable = new Hashtable();
            course           objCurso     = new course();

            ObjItem.ExtractValues(ObjHashTable);

            objCurso.id        = Convert.ToInt32(ObjHashTable["idCurso"]);
            objCurso.name      = IsNull(ObjHashTable["nombre"]) ? "" : ObjHashTable["nombre"].ToString();
            objCurso.id_career = IsNull(ObjHashTable["name"]) ? 0 : Convert.ToInt32(ObjHashTable["name"]);

            strResultado = ReglasNegocio(objCurso);

            if (strResultado.Equals(string.Empty))
            {
                clsCurso curso = new clsCurso();
                curso.prCurso = objCurso;

                strResultado = curso.EditarCurso();

                if (strResultado.Equals(string.Empty))
                {
                    base.EnvioMensaje("Datos actualizados correctamente.", 2, this.Manejador);
                    this.rdgCursos.Rebind();
                }
                else
                {
                    base.EnvioMensaje(strResultado, 2, this.Manejador);
                }
            }
            else
            {
                base.EnvioMensaje(strResultado, 1, this.Manejador);
            }
        }
        catch (Exception ex)
        {
            this.rdgCursos.MasterTableView.ClearEditItems();
            base.EnvioMensaje("Error al actualizar datos: " + ex.Message.ToString(), 1, this.Manejador);
        }
    }