Exemplo n.º 1
0
        public static bool Update(clsResponsible objProxy)
        {
            ValidationException x = new ValidationException();
            if (objProxy.IResponsible_id <= 0)
                x.AgregarError("Ingrese el código");

            if (string.IsNullOrEmpty(objProxy.SPerson_name) && string.IsNullOrEmpty(objProxy.SPerson_lname))
                x.AgregarError("verifique el nombre y el apellido de la persona");

            if (x.Cantidad > 0)
                throw x;

            DAOResponsible daoProxy = new DAOResponsible();
            return daoProxy.Update(objProxy.IResponsible_id, objProxy.SPerson_name, objProxy.SPerson_lname, objProxy.SPerson_dni, objProxy.SPerson_phone, objProxy.SPerson_email, objProxy.SUsername, objProxy.SPassword, objProxy.IRol_id.IRol_id, objProxy.DStart_time, objProxy.DEnd_time, objProxy.SStatus);
        }
Exemplo n.º 2
0
        public static int Insert(clsResponsible objProxy)
        {
            ValidationException x = new ValidationException();
            if (string.IsNullOrEmpty(objProxy.SPerson_name)&& string.IsNullOrEmpty(objProxy.SPerson_lname))
                x.AgregarError("verifique el nombre y el apellido de la persona");
            if (objProxy.DEnd_time <= objProxy.DStart_time)
                x.AgregarError("La fecha de fin deber ser mayor a la fecha de inicio");
            if (string.IsNullOrEmpty(objProxy.SUsername))
                x.AgregarError("Ingrese un nombre de usuario");
            if (string.IsNullOrEmpty(objProxy.SPassword))
                x.AgregarError("Ingrese una contrasenia");
            if (x.Cantidad > 0)
                throw x;

            DAOResponsible daoProxy = new DAOResponsible();
            return daoProxy.Insert(objProxy.SPerson_name, objProxy.SPerson_lname,objProxy.SPerson_dni,objProxy.SPerson_phone, objProxy.SPerson_email,objProxy.SUsername,objProxy.SPassword,objProxy.IRol_id.IRol_id,objProxy.DStart_time, objProxy.DEnd_time,objProxy.SStatus);
        }
Exemplo n.º 3
0
        protected void btnGuardarResponsibles_Click(object sender, EventArgs e)
        {
            clsResponsible Responsible = new clsResponsible();
            Responsible.SPerson_dni = txtCi.Text;
            Responsible.SPerson_name = txtFName.Text;
            Responsible.SPerson_lname = txtLName.Text;
            Responsible.SPerson_phone = txtPhone.Text;
            Responsible.SPerson_email = txtEmail.Text;
            Responsible.SUsername = txtUsername.Text;
            Responsible.SPassword = txtPassword.Text;
            //if (txtStartdate.Text != "")
            //    Responsible.DStart_time = Convert.ToDateTime(txtStartdate.Text);
            DateTime Start_time = new DateTime();
            Start_time = DateTime.ParseExact(txtStartdate.Text, "dd-MM-yyyy", null);
            Responsible.DStart_time = Start_time;
            //if(txtEnddate.Text!="")

            DateTime End_time = new DateTime();
            End_time = DateTime.ParseExact(txtEnddate.Text, "dd-MM-yyyy", null);
            Responsible.DEnd_time = End_time;
            clsRol rol = CRol.SelectRow(Convert.ToInt32(ddlRol.SelectedValue));
            //Responsible.IRol_id.IRol_id = c.IRol_id;
            Responsible.IRol_id = rol;

            if (string.IsNullOrEmpty(txtCodigo.Text))
            {
                int iResponsible_id = CResponsible.Insert(Responsible);
                txtCodigo.Text = iResponsible_id.ToString();
                pnlBuscar.Visible = true;
                LoadResponsibles();
                grdResponsibles.Enabled = true;

            }
            else
            {
                Responsible.IResponsible_id = Convert.ToInt32(txtCodigo.Text);
                CResponsible.Update(Responsible);
                LoadResponsibles();
            }
        }
Exemplo n.º 4
0
        private static clsResponsible Load(DataRow fila)
        {
            clsResponsible objProxy = new clsResponsible();

            objProxy.IResponsible_id = Convert.ToInt32(fila["iPerson_id"]);
            objProxy.SPerson_name = fila["sPerson_name"].ToString();
            objProxy.SPerson_lname = fila["sPerson_lname"].ToString();
            objProxy.SPerson_dni = fila["sPerson_dni"].ToString();
            objProxy.SPerson_phone = fila["sPerson_phone"].ToString();
            objProxy.SPerson_email = fila["sPerson_email"].ToString();
            objProxy.SUsername = fila["sUsername"].ToString();
            objProxy.SPassword = fila["sPassword"].ToString();
            clsRol rol = CRol.SelectRow(Convert.ToInt32(fila["iRol_id"]));
            objProxy.IRol_id = rol;
            //objProxy.IRol_id.IRol_id = Convert.ToInt32(fila["iRol_id"]);
            objProxy.DStart_time = Convert.ToDateTime(fila["dtStart_time"]);
            objProxy.DEnd_time = Convert.ToDateTime(fila["dtEnd_time"]);
            //objProxy.SStatus = Convert.ToInt32(fila["sStatus"]);

            return objProxy;
        }