public int RegisterInspection(InspectionRegistration inspectionReg) { int result = 0; string[] tableNames = new string[1]; Dictionary <string, object> cmdParams = new Dictionary <string, object>(); cmdParams.Add("@GrowerId", inspectionReg.GrowerId); cmdParams.Add("@ProductCategoryId", inspectionReg.ProductCategoryId); cmdParams.Add("@ProductId", inspectionReg.ProductId); cmdParams.Add("@Area", inspectionReg.Area); cmdParams.Add("@PlantingDate", inspectionReg.PlantingDate); cmdParams.Add("@SeedClassId", inspectionReg.SeedClassId); cmdParams.Add("@SeedSource", inspectionReg.SeedSource); cmdParams.Add("@Certificate", inspectionReg.Certificate); cmdParams.Add("@SeedLot", inspectionReg.SeedLot); cmdParams.Add("@CroppingHistory", inspectionReg.CroppingHistory); cmdParams.Add("@Remarks", inspectionReg.Remarks); cmdParams.Add("@SeedSourceEvidence", inspectionReg.SeedSourceEvidence); cmdParams.Add("@GPS", inspectionReg.GPS); cmdParams.Add("@PaymentOption", inspectionReg.PaymentOption); cmdParams.Add("@Status", inspectionReg.Status); DataSet ds = dbRepo.ExecuteProcedure("CreateInspectionRegistration", 0, tableNames, cmdParams); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]); } return(result); }
public int AssignInspector(InspectionRegistration inspectionReg) { int result = 0; string[] tableNames = new string[1]; Dictionary <string, object> cmdParams = new Dictionary <string, object>(); cmdParams.Add("@RegId", inspectionReg.ID); cmdParams.Add("@InspectorId", inspectionReg.InspectorId); cmdParams.Add("@Status", inspectionReg.Status); DataSet ds = dbRepo.ExecuteProcedure("AssignInspector", 0, tableNames, cmdParams); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { result = Convert.ToInt32(ds.Tables[0].Rows[0]["Result"]); } return(result); }
public int RegisterInspection(InspectionRegistration inspectionReg) { IAdminFacade adminFacade = new AdminFacade(); return(adminFacade.RegisterInspection(inspectionReg)); }
public int AssignInspector(InspectionRegistration inspectionReg) { IAdminFacade adminFacade = new AdminFacade(); return(adminFacade.AssignInspector(inspectionReg)); }
public List <InspectionRegistration> GetRegistrationsByUser(int mode, int userId) { IAdminRepository adminRepo = new AdminRepository(); DataSet ds = adminRepo.GetRegistrationsByUser(mode, userId); List <InspectionRegistration> regList = new List <InspectionRegistration>(); if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { if (mode == 0) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { InspectionRegistration ir = new InspectionRegistration() { ID = Convert.ToInt32(ds.Tables[0].Rows[i]["RegID"]), GrowerName = Convert.ToString(ds.Tables[0].Rows[i]["GrowerName"]), InspectorName = Convert.ToString(ds.Tables[0].Rows[i]["InspectorName"]), ProductCategory = new ProductCategory() { ProductCategoryName = Convert.ToString(ds.Tables[0].Rows[i]["ProductCategoryName"]) }, Product = new Product() { ProductName = Convert.ToString(ds.Tables[0].Rows[i]["ProductName"]) }, ProductClass = new ProductClass() { ClassName = Convert.ToString(ds.Tables[0].Rows[i]["SeedClass"]) }, Status = Convert.ToString(ds.Tables[0].Rows[i]["status"]), CreatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["CreatedAt"]), CreatedBy = Convert.ToString(ds.Tables[0].Rows[i]["CreatedBy"]), UpdatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["UpdatedAt"]), UpdatedBy = Convert.ToString(ds.Tables[0].Rows[i]["UpdatedBy"]) }; regList.Add(ir); } } else if (mode == 1) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { InspectionRegistration ir = new InspectionRegistration() { ID = Convert.ToInt32(ds.Tables[0].Rows[i]["RegID"]), GrowerName = Convert.ToString(ds.Tables[0].Rows[i]["GrowerName"]), InspectorName = Convert.ToString(ds.Tables[0].Rows[i]["InspectorName"]), Area = Convert.ToString(ds.Tables[0].Rows[i]["Area"]), CroppingHistory = Convert.ToString(ds.Tables[0].Rows[i]["CroppingHistory"]), SeedSource = Convert.ToString(ds.Tables[0].Rows[i]["SeedSource"]), Status = Convert.ToString(ds.Tables[0].Rows[i]["status"]), ProductCategory = new ProductCategory() { ProductCategoryName = Convert.ToString(ds.Tables[0].Rows[i]["ProductCategoryName"]) }, Product = new Product() { ProductName = Convert.ToString(ds.Tables[0].Rows[i]["ProductName"]) }, ProductClass = new ProductClass() { ClassName = Convert.ToString(ds.Tables[0].Rows[i]["SeedClass"]) }, User = new DataContracts.Users.User() { MobileNumber = Convert.ToString(ds.Tables[0].Rows[i]["MobileNumber"]), Address = new DataContracts.Common.Address() { AddressLine1 = Convert.ToString(ds.Tables[0].Rows[i]["Address"]), Section = new DataContracts.Common.Section() { SectionName = Convert.ToString(ds.Tables[0].Rows[i]["SectionName"]) }, EPA = new DataContracts.Common.EPA() { EPAName = Convert.ToString(ds.Tables[0].Rows[i]["EPA"]) }, District = new DataContracts.Common.District() { DistrictName = Convert.ToString(ds.Tables[0].Rows[i]["DistrictName"]) }, State = new DataContracts.Common.State() { StateName = Convert.ToString(ds.Tables[0].Rows[i]["StateName"]) }, Country = new DataContracts.Common.Country() { CountryName = Convert.ToString(ds.Tables[0].Rows[i]["CountryName"]) } } }, CreatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["CreatedAt"]), CreatedBy = Convert.ToString(ds.Tables[0].Rows[i]["CreatedBy"]), UpdatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["UpdatedAt"]), UpdatedBy = Convert.ToString(ds.Tables[0].Rows[i]["UpdatedBy"]) }; regList.Add(ir); } } else if (mode == 2) { for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { InspectionRegistration ir = new InspectionRegistration() { ID = Convert.ToInt32(ds.Tables[0].Rows[i]["RegID"]), GrowerName = Convert.ToString(ds.Tables[0].Rows[i]["GrowerName"]), ProductCategory = new ProductCategory() { ProductCategoryName = Convert.ToString(ds.Tables[0].Rows[i]["ProductCategoryName"]) }, Product = new Product() { ProductName = Convert.ToString(ds.Tables[0].Rows[i]["ProductName"]) }, ProductClass = new ProductClass() { ClassName = Convert.ToString(ds.Tables[0].Rows[i]["SeedClass"]) }, Status = Convert.ToString(ds.Tables[0].Rows[i]["status"]), CreatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["CreatedAt"]), CreatedBy = Convert.ToString(ds.Tables[0].Rows[i]["CreatedBy"]), UpdatedAt = Convert.ToDateTime(ds.Tables[0].Rows[i]["UpdatedAt"]), UpdatedBy = Convert.ToString(ds.Tables[0].Rows[i]["UpdatedBy"]) }; regList.Add(ir); } } else { //do nothing } } return(regList); }
public int RegisterInspection(InspectionRegistration inspectionReg) { IAdminRepository adminRepo = new AdminRepository(); return(adminRepo.RegisterInspection(inspectionReg)); }
public int AssignInspector(InspectionRegistration inspectionReg) { IAdminRepository adminRepo = new AdminRepository(); return(adminRepo.AssignInspector(inspectionReg)); }
public int AssignInspector(InspectionRegistration inspectionReg) { IAdminBLL adminBll = new AdminBLL(); return(adminBll.AssignInspector(inspectionReg)); }
public int RegisterInspection(InspectionRegistration inspectionReg) { IAdminBLL adminBll = new AdminBLL(); return(adminBll.RegisterInspection(inspectionReg)); }