示例#1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (!this.fudCriminal.HasFile)
            {
                base.AlertMessage("Please select file.");
                this.fudCriminal.Focus();
                return;
            }

            #region Sub-Distributor
            if (OtherRaidType == "SubRaid")
            {
            }

            BPSC.Common.ExcelTemplate excelTemplate = new BPSC.Common.ExcelTemplate("Market_Sweep_SubDistributor_Template.xls");
            bool isValid = true;
            DataTable dt = excelTemplate.GetDataFromExcel(fudCriminal, out isValid);
            if (!isValid)
            {
                AlertMessage("The format of raid file is error. Please check it, try again later.");
                return;
            }

            StoreEntity storeEntity = null;
            AreaEntity areaEntity = null;
            DataSet dsTemp = null;
            List<NormalRaidEntity> listNormalRaidEntity = new List<NormalRaidEntity>();
            NormalRaidEntity normalRaidEntity = null;
            int colIndex = 0;
            string actionNo, actionDate, storeSeq, I_Or_Raid;
            for (int j = 0; j < dt.Rows.Count; j++)
            {
                normalRaidEntity = new NormalRaidEntity();
                colIndex = 0;
                I_Or_Raid = dt.Rows[j][0].ToString().Trim();
                if(I_Or_Raid != "Investigation" && I_Or_Raid != "Raid")
                {
                    AlertMessage(string.Format("IOrRaid value is not 'Investigation' or 'Raid'! {0} is wrong!",I_Or_Raid));
                    this.fudCriminal.Focus();
                    return;
                }
                actionNo = dt.Rows[j][4].ToString().Trim();
                if (CheckActionNOIsExist(actionNo))
                {
                    AlertMessage("Investigation  NO is exist, please try another again! ");
                    this.fudCriminal.Focus();
                    return;
                }

                try
                {
                    actionDate = dt.Rows[j][5].ToString().Trim();
                    normalRaidEntity.ActionDate = Convert.ToDateTime(actionDate);
                }
                catch (Exception ex)
                {
                    AlertMessage("ActionDate format error.");
                    this.fudCriminal.Focus();
                    return;
                }

                //Subject SEQ
                storeSeq = dt.Rows[j][8].ToString().Trim();
                storeEntity = MainService.StoreBLLService.GetStoreEntityByIdStoreSeq(storeSeq);
                if (storeEntity == null)
                {
                    AlertMessage("Store not exist");
                    this.fudCriminal.Focus();
                    return;
                }
                else
                {
                    normalRaidEntity.StoreName = storeEntity.StoreName;
                    normalRaidEntity.StoreId = storeEntity.StoreId;

                    normalRaidEntity.Province = storeEntity.Province;
                    normalRaidEntity.City = storeEntity.City;
                    normalRaidEntity.SubCity = storeEntity.Village;

                    areaEntity = null;
                    areaEntity = MainService.AreaBLLService.GetAreaEntityByLevelCHName(1, storeEntity.Province.Trim());
                    if (areaEntity != null && areaEntity.AreaId != null)
                    {
                        normalRaidEntity.ProvinceId = areaEntity.AreaId;
                    }
                    else
                    {
                        normalRaidEntity.ProvinceId = -1;
                    }

                    areaEntity = null;
                    areaEntity = MainService.AreaBLLService.GetAreaEntityByLevelCHNamePID(2, storeEntity.City.Trim(), normalRaidEntity.ProvinceId);
                    if (areaEntity != null && areaEntity.AreaId != null)
                    {
                        normalRaidEntity.CityId = areaEntity.AreaId;
                    }
                    else
                    {
                        normalRaidEntity.CityId = -1;
                    }

                    areaEntity = null;
                    areaEntity = MainService.AreaBLLService.GetAreaEntityByLevelCHNamePID(3, storeEntity.Village.Trim(), normalRaidEntity.CityId);
                    if (areaEntity != null && areaEntity.AreaId != null)
                    {
                        normalRaidEntity.SubCityId = areaEntity.AreaId;
                    }
                    else
                    {
                        normalRaidEntity.SubCityId = -1;
                    }
                }


                normalRaidEntity.Type = OtherRaidType;

                //normalRaidEntity.IOrRaid = "Investigation"; // 1是Investigation
                normalRaidEntity.IOrRaid = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.SourceType = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.SourceId = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.Project = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.No = dt.Rows[j][colIndex++].ToString().Trim();
                colIndex++;
                //normalRaidEntity.ActionDate = Convert.ToDateTime(dt.Rows[j][4].ToString().Trim()); //前面已赋值
                normalRaidEntity.Region = dt.Rows[j][colIndex++].ToString().Trim();  //"GC";
                normalRaidEntity.Country = dt.Rows[j][colIndex++].ToString().Trim(); //"China";
                normalRaidEntity.SubjectSeq = dt.Rows[j][colIndex++].ToString().Trim();


                normalRaidEntity.Enforcementunit = dt.Rows[j][colIndex++].ToString().Trim();
                dsTemp = null;
                dsTemp = MainService.NormalRaidBLLService.QueryByCondition<SysParameterEntity>(
                                              BPSC.Common.Utils.QueryCondition.Create()
                                              .Equals(SysParameterTable.C_PARAMETER_TYPE, "EnforcementUnit")
                                              .Equals(SysParameterTable.C_PARAMETER_NAME, normalRaidEntity.Enforcementunit));
                if (dsTemp != null && dsTemp.Tables.Count > 0 && dsTemp.Tables[0].Rows.Count > 0)
                {
                    normalRaidEntity.EnforcementunitId = dsTemp.Tables[0].Rows[0][SysParameterTable.C_PARAMETER_VALUE].ToString().Trim();
                }

                normalRaidEntity.ExecutionArea = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.ExecutionUnit = dt.Rows[j][colIndex++].ToString().Trim();

                normalRaidEntity.SubjectType = dt.Rows[j][colIndex++].ToString().Trim();
                dsTemp = null;
                dsTemp = MainService.NormalRaidBLLService.QueryByCondition<SysParameterEntity>(
                                              BPSC.Common.Utils.QueryCondition.Create()
                                              .Equals(SysParameterTable.C_PARAMETER_TYPE, "SubjectType")
                                              .Equals(SysParameterTable.C_PARAMETER_NAME, normalRaidEntity.SubjectType));
                if (dsTemp != null && dsTemp.Tables.Count > 0 && dsTemp.Tables[0].Rows.Count > 0)
                {
                    normalRaidEntity.SubjectTypeId = dsTemp.Tables[0].Rows[0][SysParameterTable.C_PARAMETER_VALUE].ToString().Trim();
                }

                normalRaidEntity.SubSubjectType = dt.Rows[j][colIndex++].ToString().Trim();
                dsTemp = null;
                dsTemp = MainService.NormalRaidBLLService.QueryByCondition<SysParameterEntity>(
                                              BPSC.Common.Utils.QueryCondition.Create()
                                              .Equals(SysParameterTable.C_PARAMETER_TYPE, normalRaidEntity.SubjectType)
                                              .Equals(SysParameterTable.C_PARAMETER_NAME, normalRaidEntity.SubSubjectType));

                if (dsTemp != null && dsTemp.Tables.Count > 0 && dsTemp.Tables[0].Rows.Count > 0)
                {
                    normalRaidEntity.SubSubjectTypeId = dsTemp.Tables[0].Rows[0][SysParameterTable.C_PARAMETER_VALUE].ToString().Trim();
                }

                normalRaidEntity.WholeSaleMarket = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.InvestigationResult = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.SubjectNote = dt.Rows[j][colIndex++].ToString().Trim();
                normalRaidEntity.ExecutionResult = dt.Rows[j][colIndex++].ToString().Trim();

                normalRaidEntity.AgencyId = this.ddlAgency.SelectedValue;
                normalRaidEntity.Agency = this.ddlAgency.SelectedItem.Text;

                normalRaidEntity.StatusReportCfjds = 0;
                normalRaidEntity.StatusReportJdbg = 0;
                normalRaidEntity.StatusReportKyqd = 0;
                normalRaidEntity.StatusReportXdbg = 0;
                normalRaidEntity.StatusReportXhzm = 0;
                normalRaidEntity.StatusReportXrzl = 0;

                normalRaidEntity.CreateDate = DateTime.Now;
                normalRaidEntity.CreateUser = base.CurrentUser.SecUserEntity.UserId;

                normalRaidEntity.UserId = ddlUser.SelectedValue;
                normalRaidEntity.UserName = ddlUser.SelectedItem.Text;

                listNormalRaidEntity.Add(normalRaidEntity);
            }

            int total_success_import = 0;
            int total_valid_product = listNormalRaidEntity.Count;
            foreach (NormalRaidEntity entity in listNormalRaidEntity)
            {

                if (MainService.NormalRaidBLLService.InsertNormalRaid(entity, null, null, null, null, true))
                    total_success_import += 1;
            }

            if (total_success_import > 0)
            {
                base.AlertMessage(total_success_import.ToString() + " raids are valid, and import successfully!");
            }
            else
            {
                base.AlertMessage("All raids are invalid. Please check, try it later.");
            }

            #endregion
        }
示例#2
0
        public void InitPage(NormalRaidEntity normalRaidEntity)
        {
            if (normalRaidEntity.Type == "NormalRaid")
            {
                litRaidType.Text = "Normal Raid";
            }
            if (normalRaidEntity.Type == "WholeSaleRaid")
            {
                litRaidType.Text = "WholeSale Raid";
            }
            else if (normalRaidEntity.Type == "SubRaid")
            {
                litRaidType.Text = "Sub-D Raid";
            }
            else if (normalRaidEntity.Type == "MarketSweep")
            {
                litRaidType.Text = "Market Sweep Raid";
            }


            if (normalRaidEntity.IOrRaid == "Investigation")
            {
                litType.Text = "Investigation";
                locActionNo.Text = "Investigation No ";
            }
            else
            {
                litType.Text = "Raid";
                locActionNo.Text = "Action NO";
            }

            if (normalRaidEntity.SourceType != null && normalRaidEntity.SourceType != string.Empty)
            {
                //litSourceType.Text = normalRaidEntity.SourceType ;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("SourceType", normalRaidEntity.SourceType);
                if (entity != null)
                {
                    litSourceType.Text = entity.ParameterName;
                }
            }

            litSourceID.Text = normalRaidEntity.SourceId ?? string.Empty;

            if (normalRaidEntity.Project != null && normalRaidEntity.Project != string.Empty)
            {
                //litProject.Text = normalRaidEntity.Project ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("Project", normalRaidEntity.Project);
                if (entity != null)
                {
                    litProject.Text = entity.ParameterName;
                }
            }


            litActionNo.Text = normalRaidEntity.No ?? string.Empty;
            litRaidDate.Text = normalRaidEntity.ActionDate.ToShortDateString();

            litSubjectSEQ.Text = normalRaidEntity.SubjectSeq ?? string.Empty;

            //Modify by Andy.Gui on 2011/12/29, Store的修改不影响Raid数据
            litSubjectName.Text = normalRaidEntity.StoreName ?? string.Empty;
            //StoreEntity storeEntity = MainService.StoreBLLService.GetStoreEntityByIdStoreSeq(normalRaidEntity.SubjectSeq);
            //if (storeEntity != null)
            //{
            //    litSubjectName.Text = storeEntity.StoreName;
            //}
            //End modify by Andy.Gui on 2011/12/29

            if (normalRaidEntity.Region != null && normalRaidEntity.Region != string.Empty)
            {
                //litRegion.Text = normalRaidEntity.Region ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("Region", normalRaidEntity.Region);
                if (entity != null)
                {
                    litRegion.Text = entity.ParameterName;
                }
            }

            if (normalRaidEntity.Country != null && normalRaidEntity.Country != string.Empty)
            {
                //litCountry.Text = normalRaidEntity.Country ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("Country", normalRaidEntity.Country);
                if (entity != null)
                {
                    litCountry.Text = entity.ParameterName;
                }
            }

            litProvince.Text = normalRaidEntity.Province ?? string.Empty;
            litCity.Text = normalRaidEntity.City ?? string.Empty;
            litSubCity.Text = normalRaidEntity.SubCity ?? string.Empty;


            litEnforcementUnit.Text = normalRaidEntity.Enforcementunit ?? string.Empty;

            if (normalRaidEntity.ExecutionArea != null && normalRaidEntity.ExecutionArea != string.Empty)
            {
                //litExecutionArea.Text = normalRaidEntity.ExecutionArea ?? string.Empty;
                AreaEntity entity = MainService.AreaBLLService.GetAreaEntityById(normalRaidEntity.ExecutionArea);
                if (entity != null)
                {
                    litExecutionArea.Text = entity.AreaName;
                }
            }
            if (normalRaidEntity.ExecutionUnit != null && normalRaidEntity.ExecutionUnit != string.Empty)
            {
                //litExecutionUnit.Text = normalRaidEntity.ExecutionUnit ?? string.Empty;
                AreaEntity entity = MainService.AreaBLLService.GetAreaEntityById(normalRaidEntity.ExecutionUnit);
                if (entity != null)
                {
                    litExecutionUnit.Text = entity.AreaName;
                }
            }
            litSubjectType.Text = normalRaidEntity.SubjectType ?? string.Empty;
            litSubSubjectType.Text = normalRaidEntity.SubSubjectType ?? string.Empty;

            if (normalRaidEntity.WholeSaleMarket != null && normalRaidEntity.WholeSaleMarket != string.Empty)
            {
                //litWholeSaleMarket.Text = normalRaidEntity.WholeSaleMarket ?? string.Empty;
                AreaEntity entity = MainService.AreaBLLService.GetAreaEntityById(normalRaidEntity.WholeSaleMarket);
                if (entity != null)
                {
                    litWholeSaleMarket.Text = entity.AreaName;
                }
            }
            if (normalRaidEntity.InvestigationResult != null && normalRaidEntity.InvestigationResult != string.Empty)
            {
                //litInvestigationResult.Text = normalRaidEntity.InvestigationResult ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("InvestigationResult", normalRaidEntity.InvestigationResult);
                if (entity != null)
                {
                    litInvestigationResult.Text = entity.ParameterName;
                }
            }
            if (normalRaidEntity.SubjectNote != null && normalRaidEntity.SubjectNote != string.Empty)
            {
                //litSubjectNote.Text = normalRaidEntity.SubjectNote ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("SubjectNote", normalRaidEntity.SubjectNote);
                if (entity != null)
                {
                    litSubjectNote.Text = entity.ParameterName;
                }
            }
            if (normalRaidEntity.Destination != null && normalRaidEntity.Destination != string.Empty)
            {
                //litDestination.Text = normalRaidEntity.Destination ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("Destination", normalRaidEntity.Destination);
                if (entity != null)
                {
                    litDestination.Text = entity.ParameterName;
                }
            }
            if (normalRaidEntity.ExecutionResult != null && normalRaidEntity.ExecutionResult != string.Empty)
            {
                //litExecutionResult.Text = normalRaidEntity.ExecutionResult ?? string.Empty;
                SysParameterEntity entity = MainService.SysParameterBLLService.GetEntityByTypeValue("ExecutionResult", normalRaidEntity.ExecutionResult);
                if (entity != null)
                {
                    litExecutionResult.Text = entity.ParameterName;
                }
            }
            if (normalRaidEntity.Agency != null && normalRaidEntity.Agency != string.Empty)
            {
                litAgency.Text = normalRaidEntity.Agency ?? string.Empty;
                SecUserEntity entity = MainService.SecUserBLLService.GetById<SecUserEntity>(normalRaidEntity.Agency);
                if (entity != null)
                {
                    litAgency.Text = entity.ChineseName;
                }
            }



            //this.litDataTypeRaids.Text = normalRaidEntity.Raidtype ?? string.Empty;
            //this.litVillage.Text = normalRaidEntity.Village ?? string.Empty;

            //this.litTypeTaget.Text = normalRaidEntity.Targettype ?? string.Empty;
            //this.litRecidivist.Text = normalRaidEntity.Recidivist.ToString();

            //this.litDataTypeRaids.Text = normalRaidEntity.Raidtype ?? string.Empty;
            //this.litContractType.Text = normalRaidEntity.ActionName ?? string.Empty;

            this.litSeizureVolumeCase.Text = normalRaidEntity.Seizurevolumecase.ToString();
            this.litSeizureVolumeItem.Text = normalRaidEntity.Seizurevolumeitem.ToString();
            this.litTotalValueUSD.Text = normalRaidEntity.Totalvalueusd.ToString(".##");

            BindOwnerData();
            BindEquipmentData();
            //SetFileStatus();

            locFile1.Text = normalRaidEntity.StatusReportKyqd > 0 ? "Yes" : "No";
            locFile2.Text = normalRaidEntity.StatusReportXdbg > 0 ? "Yes" : "No";
            locFile3.Text = normalRaidEntity.StatusReportXhzm > 0 ? "Yes" : "No";
            locFile4.Text = normalRaidEntity.StatusReportCfjds > 0 ? "Yes" : "No";
            locFile5.Text = normalRaidEntity.StatusReportXrzl > 0 ? "Yes" : "No";
            locFile6.Text = normalRaidEntity.StatusReportJdbg > 0 ? "Yes" : "No";

        }
示例#3
0
 public NormalRaidDomain(NormalRaidEntity entity)
     : base(entity)
 {
     masterEntity = entity;
 }