Example #1
0
 partial void UpdateSys_RoleMaster_rlm(Sys_RoleMaster_rlm instance);
Example #2
0
 partial void DeleteSys_RoleMaster_rlm(Sys_RoleMaster_rlm instance);
Example #3
0
 partial void InsertSys_RoleMaster_rlm(Sys_RoleMaster_rlm instance);
Example #4
0
        public bool UpdateRecord(Sys_RoleMaster_rlm_Info infoObject)
        {
            string sqlString = string.Empty;
            using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
            {
                Sys_RoleMaster_rlm rlm = new Sys_RoleMaster_rlm();
                Sys_RoleMaster_rlm_Info info = new Sys_RoleMaster_rlm_Info();
                try
                {

                    rlm = db.Sys_RoleMaster_rlm.SingleOrDefault(t => t.rlm_iRecordID == infoObject.rlm_iRecordID);

                    for (int i = 0; i < rlm.Sys_UserRoles_usr.Count; i++)
                    {
                        Sys_UserRoles_usr sta = rlm.Sys_UserRoles_usr[i];
                        db.Sys_UserRoles_usr.DeleteOnSubmit(sta);
                    }

                    info = Common.General.CopyObjectValue<Sys_RoleMaster_rlm, Sys_RoleMaster_rlm_Info>(rlm);

                    IEnumerable<Sys_RoleMaster_rlm_Info> IErlm = null;
                    IEnumerable<Sys_UserRoles_usr_Info> IEusr = null;

                    sqlString += "UPDATE Sys_RoleMaster_rlm" + Environment.NewLine;
                    sqlString += " SET rlm_cRoleID='" + infoObject.rlm_cRoleID + "'," + Environment.NewLine;
                    sqlString += " rlm_cRoleDesc='" + infoObject.rlm_cRoleDesc + "'," + Environment.NewLine;
                    sqlString += " rlm_cLast='" + infoObject.rlm_cLast + "'," + Environment.NewLine;
                    sqlString += " rlm_dLastDate='" + infoObject.rlm_dLastDate.Value.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine;
                    sqlString += " WHERE rlm_iRecordID='" + infoObject.rlm_iRecordID + "'";

                    IErlm = db.ExecuteQuery<Sys_RoleMaster_rlm_Info>(sqlString, new object[] { });

                    sqlString = string.Empty;
                    sqlString += "DELETE FROM Sys_UserRoles_usr WHERE usr_cRoleID='" + infoObject.rlm_cRoleID + "'";
                    IEusr = db.ExecuteQuery<Sys_UserRoles_usr_Info>(sqlString, new object[] { });

                    if (infoObject.userMasterList != null && infoObject.userMasterList.Count > 0)
                    {
                        for (int i = 0; i < infoObject.userMasterList.Count; i++)
                        {
                            sqlString = string.Empty;
                            Sys_UserMaster_usm_Info usmInfo = infoObject.userMasterList[i];

                            sqlString += "INSERT INTO Sys_UserRoles_usr" + Environment.NewLine;
                            sqlString += "(usr_cUserLoginID, usr_cRoleID)" + Environment.NewLine;
                            sqlString += " VALUES " + Environment.NewLine;
                            sqlString += "('" + usmInfo.usm_cUserLoginID + "','" + infoObject.rlm_cRoleID + "')";

                            IEusr = db.ExecuteQuery<Sys_UserRoles_usr_Info>(sqlString, new object[] { });
                        }
                    }

                    //if (rlm != null)
                    //{
                    //    //usm = Common.General.SetDataToLingQEntity(usm, infoObject);//时间溢出
                    //    rlm.rlm_cRoleDesc = infoObject.rlm_cRoleDesc;
                    //    rlm.rlm_cLast = infoObject.rlm_cLast;
                    //    rlm.rlm_dLastDate = infoObject.rlm_dLastDate.Value;

                    //    if (infoObject.userMasterList != null && infoObject.userMasterList.Count > 0)
                    //    {
                    //        for (int i = 0; i < infoObject.userMasterList.Count; i++)
                    //        {
                    //            Sys_UserMaster_usm_Info usmInfo = infoObject.userMasterList[i];

                    //            Sys_UserRoles_usr item = new Sys_UserRoles_usr();

                    //            item.usr_cUserLoginID = usmInfo.usm_cUserLoginID;
                    //            item.usr_cRoleID = infoObject.rlm_cRoleID;
                    //            //courseitem.cum_cNumber;
                    //            rlm.Sys_UserRoles_usrs.Add(item);
                    //            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                    //        }
                    //    }
                    //    db.SubmitChanges();
                    //}
                    return true;
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Example #5
0
        public bool IsExistRecord(object KeyObject)
        {
            using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
            {
                Sys_RoleMaster_rlm rlm = new Sys_RoleMaster_rlm();
                try
                {
                    rlm = Common.General.CopyObjectValue<object, Sys_RoleMaster_rlm>(KeyObject);

                    IQueryable<Sys_RoleMaster_rlm> taQuery =
                            (from ta in db.Sys_RoleMaster_rlm where ta.rlm_cRoleID == rlm.rlm_cRoleID select ta);
                    if (taQuery.Count() > 0)
                    {
                        return true;
                    }
                    else
                    {
                        return false;
                    }
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Example #6
0
        public bool InsertRecord(Sys_RoleMaster_rlm_Info infoObject)
        {
            if (infoObject == null)
            {
                return false;
            }

            using (SIOTSDB_HHZXDataContext db = new SIOTSDB_HHZXDataContext())
            {
                Sys_RoleMaster_rlm rlm = new Sys_RoleMaster_rlm();
                try
                {
                    rlm = Common.General.CopyObjectValue<Sys_RoleMaster_rlm_Info, Sys_RoleMaster_rlm>(infoObject);

                    if (infoObject.userMasterList != null && infoObject.userMasterList.Count > 0)
                    {
                        for (int i = 0; i < infoObject.userMasterList.Count; i++)
                        {

                            Sys_UserMaster_usm_Info usmInfo = infoObject.userMasterList[i];

                            Sys_UserRoles_usr item = new Sys_UserRoles_usr();

                            item.usr_cUserLoginID = usmInfo.usm_cUserLoginID;
                            item.usr_cRoleID = infoObject.rlm_cRoleID;
                            //courseitem.cum_cNumber;
                            rlm.Sys_UserRoles_usr.Add(item);
                            //db.Sys_UserRoles_usrs.InsertOnSubmit(item);
                        }
                    }

                    db.Sys_RoleMaster_rlm.InsertOnSubmit(rlm);
                    db.SubmitChanges();
                    return true;
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }
Example #7
0
        public bool UpdateRecord(Sys_RoleMaster_rlm_Info infoObject)
        {
            string sqlString = string.Empty;
            using (MainDBDataContext db = new MainDBDataContext())
            {
                Sys_RoleMaster_rlm rlm = new Sys_RoleMaster_rlm();
                Sys_RoleMaster_rlm_Info info = new Sys_RoleMaster_rlm_Info();
                try
                {

                    rlm = db.Sys_RoleMaster_rlm.SingleOrDefault(t => t.rlm_iRecordID == infoObject.rlm_iRecordID);
                    List<Sys_UserRoles_usr> usrs = db.Sys_UserRoles_usr.Where(d => d.usr_cRoleID == infoObject.rlm_cRoleID).ToList();
                    for (int i = 0; i < usrs.Count; i++)
                    {
                        Sys_UserRoles_usr sta = usrs[i];
                        db.Sys_UserRoles_usr.DeleteOnSubmit(sta);
                    }

                    IEnumerable<Sys_RoleMaster_rlm_Info> IErlm = null;
                    IEnumerable<Sys_UserRoles_usr_Info> IEusr = null;

                    sqlString += "UPDATE Sys_RoleMaster_rlm" + Environment.NewLine;
                    sqlString += " SET rlm_cRoleID='" + infoObject.rlm_cRoleID + "'," + Environment.NewLine;
                    sqlString += " rlm_cRoleDesc='" + infoObject.rlm_cRoleDesc + "'," + Environment.NewLine;
                    sqlString += " rlm_cLast='" + infoObject.rlm_cLast + "'," + Environment.NewLine;
                    sqlString += " rlm_dLastDate='" + DateTime.Now.ToString(DefineConstantValue.gc_DateTimeFormat) + "'" + Environment.NewLine;
                    sqlString += " WHERE rlm_iRecordID='" + infoObject.rlm_iRecordID + "'";

                    IErlm = db.ExecuteQuery<Sys_RoleMaster_rlm_Info>(sqlString, new object[] { });

                    sqlString = string.Empty;
                    sqlString += "DELETE FROM Sys_UserRoles_usr WHERE usr_cRoleID='" + infoObject.rlm_cRoleID + "'";
                    IEusr = db.ExecuteQuery<Sys_UserRoles_usr_Info>(sqlString, new object[] { });

                    if (infoObject.userMasterList != null && infoObject.userMasterList.Count > 0)
                    {
                        for (int i = 0; i < infoObject.userMasterList.Count; i++)
                        {
                            sqlString = string.Empty;
                            Sys_UserMaster_usm_Info usmInfo = infoObject.userMasterList[i];

                            sqlString += "INSERT INTO Sys_UserRoles_usr" + Environment.NewLine;
                            sqlString += "(usr_cUserLoginID, usr_cRoleID)" + Environment.NewLine;
                            sqlString += " VALUES " + Environment.NewLine;
                            sqlString += "('" + usmInfo.usm_cUserLoginID + "','" + infoObject.rlm_cRoleID + "')";

                            IEusr = db.ExecuteQuery<Sys_UserRoles_usr_Info>(sqlString, new object[] { });
                        }
                    }

                    return true;
                }
                catch (Exception Ex)
                {
                    throw Ex;
                }
            }
        }