コード例 #1
0
ファイル: OrgaizationManageDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 删除组织机构信息
        /// </summary>
        /// <param name="orga">组织机构信息</param>
        /// <returns>删除个数</returns>
        public int Delete(Orgaization orga)
        {
            int    count = 0;
            string sql   = null;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //先删除组织机构所有权限信息
                    sql   = "DELETE T_ORGAIZATIONAUTHORITY WHERE ORGANID=@ORGANID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ORGANID", DataType = DbType.String, Value = orga.OrganID
                    });



                    //删除组织机构信息
                    sql   = "UPDATE T_ORGANIZATION SET DELFLAG = '1' WHERE ORGANID=@ORGANID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ORGANID", DataType = DbType.String, Value = orga.OrganID
                    });


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #2
0
        /// <summary>
        /// 删除用户信息信息
        /// </summary>
        /// <param name="user">用户信息信息</param>
        /// <returns>删除个数</returns>
        public int Delete(User user)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除用户所有角色信息
                    string sql = "DELETE from T_USERROLE WHERE USERID=@USERID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "USERID", DataType = DbType.String, Value = user.UserID
                    });

                    //删除用户信息信息
                    sql   = "DELETE from T_USER WHERE USERID=@USERID";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "USERID", DataType = DbType.String, Value = user.UserID
                    });

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
ファイル: GoodInfoDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 插入信息(单表)
        /// </summary>
        /// <param name="">信息</param>
        /// <returns>插入行数</returns>
        public int Insert(GoodInfo model)
        {
            int count = 0;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //插入基本信息
                    count = session.Insert <GoodInfo>(model);
                    string sql = "UPDATE T_FP_ProducePlan SET FactAmount = FactAmount+@OfflineNum WHERE PID =@PID";
                    parameters.Add(new DataParameter {
                        ParameterName = "OfflineNum", DataType = DbType.String, Value = model.OfflineNum
                    });
                    parameters.Add(new DataParameter {
                        ParameterName = "PID", DataType = DbType.String, Value = model.PLANID
                    });
                    count = session.ExecuteSql(sql, parameters.ToArray());

                    //产品组成批次号
                    sql = "update T_FP_GoodPackingForm set BatchNumber = @BatchNumber where GoodBarCode = @GoodBarCode";
                    session.ExecuteSql(sql, new DataParameter("BatchNumber", model.BatchNumber), new DataParameter("GoodBarCode", model.GoodBarCode));

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #4
0
ファイル: ProduceDOMDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(ProduceBOM model)
        {
            int    count = 0;
            string sql   = "delete from T_FP_BOMDETAIL where BOMID = @BOMID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //更新BOM信息
                    count = session.Update <ProduceBOM>(model);
                    //删除BOM明细信息
                    session.ExecuteSql(sql, new DataParameter("BOMID", model.PID));
                    foreach (BOMDetail detail in model.Details)
                    {
                        detail.PID   = Guid.NewGuid().ToString();
                        detail.BOMID = model.PID;
                        session.Insert <BOMDetail>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #5
0
ファイル: SupplyInfoDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(SupplyInfo model)
        {
            int    count = 0;
            string sql   = "delete from T_FP_SUPPLYMATERIALINFO where SUPPLYID = @SUPPLYID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    //更新BOM信息
                    count = session.Update <SupplyInfo>(model);
                    //删除BOM明细信息
                    session.ExecuteSql(sql, new DataParameter("SUPPLYID", model.PID));
                    foreach (SupplyMaterialInfo detail in model.Details)
                    {
                        detail.PID      = Guid.NewGuid().ToString();
                        detail.SUPPLYID = model.PID;
                        session.Insert <SupplyMaterialInfo>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #6
0
        /// <summary>
        /// 更新信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>更新行数</returns>
        public int Update(WHQualityCheck model)
        {
            int    count = 0;
            string sql   = "delete from T_WH_QualityCheckResult where CheckID = @CheckID";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();
                    count = session.Update <WHQualityCheck>(model);
                    session.ExecuteSql(sql, new DataParameter("CheckID", model.ID));

                    foreach (WHQualityCheckResult detail in model.QualityCheckResults)
                    {
                        detail.ID      = Guid.NewGuid().ToString();
                        detail.CheckID = model.ID;
                        session.Insert <WHQualityCheckResult>(detail);
                    }
                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #7
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(CheckStockBill info)
        {
            int    count = 0;
            string sql   = "";

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    count = session.Delete <CheckStockBill>(info);

                    sql = "delete from T_WH_CheckStockDetail where BillID = @BillID";
                    session.ExecuteSql(sql, new DataParameter("BillID", info.ID));

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #8
0
        /// <summary>
        /// 删除监测项目信息
        /// </summary>
        /// <param name="itemInfo">监测项目信息</param>
        /// <returns>删除个数</returns>
        public int Delete(InspectItemEntity itemInfo)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除监测项目信息
                    string sql = "DELETE FROM InspectItemInfo WHERE Id=@Id";
                    count = session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "Id", DataType = DbType.String, Value = itemInfo.Id
                    });

                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #9
0
        /// <summary>
        /// 删除仓库权限
        /// </summary>
        /// <param name="userID">用户主键</param>
        public void DeleteWHPowers(string userID)
        {
            string sql = "delete from T_WH_WHPower where UserID = @UserID";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.ExecuteSql(sql, new DataParameter("UserID", userID));
            }
        }
コード例 #10
0
ファイル: WHMatDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 更新条码生产日期
        /// </summary>
        /// <param name="info"></param>
        /// <param name="produceDate"></param>
        public void UpdateIDCodeProduceDate(MatIDCode info)
        {
            string sql = "";

            sql = "update T_WH_MatIDCode set ProduceDate = @ProduceDate where IDCode = @IDCode";
            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.ExecuteSql(sql, new DataParameter("IDCode", info.IDCode), new DataParameter("ProduceDate", info.ProduceDate));
            }
        }
コード例 #11
0
ファイル: UseMatDAL.cs プロジェクト: 48401298/efp
        public void Delete(UseMatBill bill)
        {
            string sql = null;

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();
                session.Delete <UseMatBill>(bill);

                sql = "delete from T_WH_UseMatAmount where USEID = @USEID";
                session.ExecuteSql(sql, new DataParameter("USEID", bill.PID));
                session.Insert <UseMatAmount>(bill.Amounts);

                sql = "delete from T_WH_UseMatDetail where USEID = @USEID";
                session.ExecuteSql(sql, new DataParameter("USEID", bill.PID));
                session.Insert <UseMatDetail>(bill.Details);
                session.CommitTs();
            }
        }
コード例 #12
0
ファイル: RoleManageDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 删除角色信息
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <returns>删除个数</returns>
        public int Delete(RoleInfo role)
        {
            int    count = 0;
            string sql   = null;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //删除权限信息,子表
                    sql = "DELETE FROM T_ROLEAUTHORITY WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });

                    //删除基本信息,主表
                    sql.Remove(0, sql.Length);
                    sql = "DELETE FROM T_ROLE WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #13
0
ファイル: WHMatDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 记录货品唯一识别码打印次数
        /// </summary>
        /// <param name="idCodeList">识别码列表</param>
        public void SignMatIDCodePrintCount(List <string> idCodeList)
        {
            string sql = "update T_WH_MatIDCode set PrintCount=PrintCount+1 where IDCode = ?IDCode";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                foreach (string idCode in idCodeList)
                {
                    session.ExecuteSql(sql, new DataParameter("IDCode", idCode));
                }

                session.CommitTs();
            }
        }
コード例 #14
0
        /// <summary>
        /// 保存仓库权限
        /// </summary>
        /// <param name="userID">用户主键</param>
        /// <param name="powers">仓库权限</param>
        public void SaveWHPowers(string userID, List <WarehousePower> powers)
        {
            string sql = "delete from T_WH_WHPower where UserID = @UserID";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                //删除
                session.ExecuteSql(sql, new DataParameter("UserID", userID));

                //新增
                session.Insert <WarehousePower>(powers);

                session.CommitTs();
            }
        }
コード例 #15
0
        /// <summary>
        /// 装箱
        /// </summary>
        /// <param name="list"></param>
        public void Packing(List <GoodPackingForm> list)
        {
            string sql = "delete from T_FP_GoodPackingForm where GoodBarCode = @GoodBarCode";

            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.OpenTs();

                //删除原装箱信息
                session.ExecuteSql(sql, new DataParameter("GoodBarCode", list[0].GoodBarCode));

                //添加装箱信息
                session.Insert <GoodPackingForm>(list);

                session.CommitTs();
            }
        }
コード例 #16
0
        public void SignPlanFinished(ProducePlan plan)
        {
            string sql = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                sql = "update T_FP_PRODUCEPLAN set STATUS = '1' where PID = @PID";
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.ExecuteSql(sql, new DataParameter("PID", plan.PID));
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #17
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(WHQualityCheck model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //删除基本信息
                    count = session.Delete <WHQualityCheck>(model);
                    //删除明细信息
                    string sql = "DELETE FROM T_WH_QualityCheckResult WHERE CheckID = @CheckID";
                    session.ExecuteSql(sql, new DataParameter("CheckID", model.ID));
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #18
0
ファイル: SupplyInfoDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(SupplyInfo model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //删除BOM信息
                    count = session.Delete <SupplyInfo>(model);
                    //删除BOM明细信息
                    string sql = "delete from T_FP_SUPPLYMATERIALINFO where SUPPLYID = @SUPPLYID";
                    session.ExecuteSql(sql, new DataParameter("SUPPLYID", model.PID));
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #19
0
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(QualityCheckInfo model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //删除BOM信息
                    count = session.Delete <QualityCheckInfo>(model);
                    //删除BOM明细信息
                    string sql = "DELETE FROM T_FP_QUALITYCHECKRESULT WHERE CheckID = @CheckID";
                    session.ExecuteSql(sql, new DataParameter("CheckID", model.ID));
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #20
0
ファイル: ProduceDOMDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 删除信息
        /// </summary>
        /// <param name=""></param>
        /// <returns>删除个数</returns>
        public int Delete(ProduceBOM model)
        {
            int count = 0;

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //删除BOM信息
                    count = session.Delete <ProduceBOM>(model);
                    //删除BOM明细信息
                    string sql = "delete from T_FP_BOMDETAIL where BOMID = @BOMID";
                    session.ExecuteSql(sql, new DataParameter("BOMID", model.PID));
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #21
0
ファイル: RoleManageDAL.cs プロジェクト: 48401298/efp
        /// <summary>
        /// 更新角色
        /// </summary>
        /// <param name="role">角色信息</param>
        /// <returns>更新个数</returns>
        public int Update(RoleInfo role)
        {
            int    count = 0;
            string sql   = null;
            List <DataParameter> parameters = new List <DataParameter>();

            try
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    session.OpenTs();

                    //更新基本信息
                    session.Update <RoleInfo>(role);

                    //更新权限信息
                    sql = "DELETE FROM T_ROLEAUTHORITY WHERE ROLEID=@ROLEID";
                    sql = this.ChangeSqlByDB(sql, session);
                    session.ExecuteSql(sql, new DataParameter {
                        ParameterName = "ROLEID", DataType = DbType.String, Value = role.RoleID
                    });

                    if (role.Powers != null)
                    {
                        session.Insert <RoleAuthority>(role.Powers);
                    }


                    session.CommitTs();
                }
                return(count);
            }
            catch (Exception ex)
            {
                throw;
            }
        }
コード例 #22
0
        /// <summary>
        /// 设置密码
        /// </summary>
        /// <param name="info">用户信息</param>
        /// <returns>影响行数</returns>
        public int SetPassWord(User info)
        {
            int    count = 0;
            string sql   = null;

            try
            {
                sql = "UPDATE T_USER SET PASSWORD=@PASSWORD,UPDATEUSER=@UPDATEUSER WHERE USERID=@USERID";

                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    count = session.ExecuteSql(sql
                                               , new DataParameter("PASSWORD", info.PassWord)
                                               , new DataParameter("UPDATEUSER", info.UpdateUser)
                                               , new DataParameter("USERID", info.UserID));
                }

                return(count);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #23
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            DateTime dt1 = DateTime.Parse("2018-5-1");
            DateTime dt2 = DateTime.Parse("2018-5-26");

            //删除数据
            using (IDataSession session = AppDataFactory.CreateMainSession())
            {
                session.ExecuteSql("delete from inspectdatainfo");
            }

            List <string> salinitys = new List <string> {
                "30", "30.1", "31.1", "31.2", "31.3", "31.4"
            };

            List <string> chlorophyls = new List <string> {
                "8", "9", "10", "11", "12", "13"
            };

            List <string> turbiditys = new List <string> {
                "200", "210", "220", "230", "240", "250"
            };

            Random rm = new Random();

            //插入数据
            while (dt1 < dt2)
            {
                using (IDataSession session = AppDataFactory.CreateMainSession())
                {
                    //温度值
                    InspectDataEntity infotemp = new InspectDataEntity();
                    infotemp.Id          = Guid.NewGuid().ToString();
                    infotemp.DeviceCode  = "ACTW-CAR1";
                    infotemp.ItemCode    = "temp";
                    infotemp.InspectTime = dt1;
                    infotemp.InspectData = (13.2 + double.Parse(dt1.Day.ToString()) * 1.5 / 30).ToString();
                    infotemp.OrganID     = "b3a97409-f63f-46db-8277-b47014657217";
                    infotemp.UpdateTime  = dt1;

                    session.Insert <InspectDataEntity>(infotemp);

                    //盐度值
                    InspectDataEntity infosalinity = new InspectDataEntity();
                    infosalinity.Id          = Guid.NewGuid().ToString();
                    infosalinity.DeviceCode  = "ACTW-CAR1";
                    infosalinity.ItemCode    = "salinity";
                    infosalinity.InspectTime = dt1;
                    infosalinity.InspectData = salinitys[rm.Next(0, 5)];
                    infosalinity.OrganID     = "b3a97409-f63f-46db-8277-b47014657217";
                    infosalinity.UpdateTime  = dt1;
                    session.Insert <InspectDataEntity>(infosalinity);

                    //叶绿素值
                    InspectDataEntity infchlorophyl = new InspectDataEntity();
                    infchlorophyl.Id          = Guid.NewGuid().ToString();
                    infchlorophyl.DeviceCode  = "ACLW-CAR1";
                    infchlorophyl.ItemCode    = "chlorophyl";
                    infchlorophyl.InspectTime = dt1;
                    infchlorophyl.InspectData = chlorophyls[rm.Next(0, 5)];
                    infchlorophyl.OrganID     = "b3a97409-f63f-46db-8277-b47014657217";
                    infchlorophyl.UpdateTime  = dt1;
                    session.Insert <InspectDataEntity>(infchlorophyl);

                    //浊度值
                    InspectDataEntity infturbidity = new InspectDataEntity();
                    infturbidity.Id          = Guid.NewGuid().ToString();
                    infturbidity.DeviceCode  = "ACLW-CAR1";
                    infturbidity.ItemCode    = "turbidity";
                    infturbidity.InspectTime = dt1;
                    infturbidity.InspectData = turbiditys[rm.Next(0, 5)];
                    infturbidity.OrganID     = "b3a97409-f63f-46db-8277-b47014657217";
                    infturbidity.UpdateTime  = dt1;

                    session.Insert <InspectDataEntity>(infturbidity);
                }

                dt1 = dt1.AddMinutes(60);
            }

            Response.Write("end");
        }