Exemplo n.º 1
0
        public Int64 InsertIntoUserRights(Int64 intUserIdno, Int32 intDesigIdno, Int32 empIdno)
        {
            Int64 intValue = 0;

            try
            {
                using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
                {
                    var lst = (from FM in db.tblDesigRights where FM.Desig_Idno == intDesigIdno select FM).ToList();
                    foreach (var UR in lst)
                    {
                        tblUserRight objUserRight = new tblUserRight();
                        objUserRight.Emp_Idno  = Convert.ToInt32(intUserIdno);
                        objUserRight.Form_Idno = UR.Form_Idno;
                        objUserRight.View      = UR.View;
                        objUserRight.User_Idno = empIdno; // this is user idno is that idno = whi is updated , deleted , modified, inserted
                        objUserRight.Edit      = UR.Edit;
                        objUserRight.Delete    = UR.Delete;
                        objUserRight.Print     = UR.Print;
                        objUserRight.ADD       = UR.ADD;
                        db.tblUserRights.AddObject(objUserRight);
                        db.SaveChanges();
                        intValue = Convert.ToInt32(objUserRight.Emp_Idno);
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(intValue);
        }
Exemplo n.º 2
0
        public bool CheckUserRights(int intFormIdno)
        {
            bool bvalue = false;

            try
            {
                WebTransport.DAL.LoginDAL objLoginDAL = new WebTransport.DAL.LoginDAL();
                UserIdno = Convert.ToInt32(Session["UserIdno"].ToString());
                tblUserRight objUserRghts = objLoginDAL.SelectUserRights(UserIdno, intFormIdno);
                UserRgt_Idno = Convert.ToInt32(objUserRghts.UserRgt_Idno);
                Form_Idno    = Convert.ToInt32(objUserRghts.Form_Idno);
                ADD          = Convert.ToBoolean(objUserRghts.ADD);
                Edit         = Convert.ToBoolean(objUserRghts.Edit);
                View         = Convert.ToBoolean(objUserRghts.View);
                Delete       = Convert.ToBoolean(objUserRghts.Delete);
                Print        = Convert.ToBoolean(objUserRghts.Print);
                if (ADD == false && Edit == false && View == false && Delete == false && Print == false)
                {
                    bvalue = false;
                }
                else
                {
                    bvalue = true;
                }
                objLoginDAL = null;
                return(bvalue);
            }
            catch (Exception Ex)
            {
            }
            return(bvalue);
        }
Exemplo n.º 3
0
        public Int32 UpdateAll(int intUserRghtsIdno, bool bAdd, bool bEdit, bool bView, bool bDelete, bool bPrint, Int32 UpdateEmpIdno)
        {
            int value = 0;

            try
            {
                using (TransportMandiEntities db = new TransportMandiEntities(MultipleDBDAL.strDynamicConString()))
                {
                    tblUserRight objtbltblUserRight = (from mast in db.tblUserRights
                                                       where mast.UserRgt_Idno == intUserRghtsIdno
                                                       select mast).FirstOrDefault();
                    if (objtbltblUserRight != null)
                    {
                        objtbltblUserRight.User_Idno = UpdateEmpIdno;
                        objtbltblUserRight.ADD       = bAdd;
                        objtbltblUserRight.Edit      = bEdit;
                        objtbltblUserRight.View      = bView;
                        objtbltblUserRight.Delete    = bDelete;
                        objtbltblUserRight.Print     = bPrint;
                        db.SaveChanges();
                        value = 1;
                    }
                }
            }
            catch (Exception ex)
            {
            }
            return(value);
        }