示例#1
0
        public bool InsertKVendor(K_Vendor a)
        {
            string sql = " Insert into  KI_Vendor (VendorName, Address,Phone,Mobile,PanNo,OrganizationId, EnteredBy, EnteredDate," +
                         " LastUpdatedBy, LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " +
                         " values " +
                         "(@VendorName, @Address,@Phone,@Mobile,@PanNo,@OrganizationId, @EnteredBy, @EnteredDate," +
                         " 0, null, 0, 0, null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, a);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#2
0
        public void DeleteAllInvetoryItem(int id, int deletedby, DateTime deleteddate)
        {
            string sql = " Update INV_PurchaseItem set IsDeleted=1,DeletedBy=" + deletedby + ",DeletedDate= '" + deleteddate + "'" +
                         " where PurchaseId=" + id;

            using (var db = DbHelper.GetDBConnection())
            {
                //using (var trsn = db.BeginTransaction())
                //{
                db.Query(sql);
                //  trsn.Commit();
                //}
            }

            //string sql1 = " Update INV_SoldItem set IsDeleted=1,DeletedBy=" + deletedby + ",DeletedDate= " + deleteddate +
            //    " where SoldBillId=" + id;

            //using (var db = DbHelper.GetDBConnection())
            //{
            //    //using (var trsn = db.BeginTransaction())
            //    //{
            //    db.Query(sql);
            //    //  trsn.Commit();
            //    //}

            //}
        }
        public bool InsertDepartment(MS_Department Department)
        {
            string sql = " Insert into  MS_Department (DepartmentName,DepartmentCode,OrganizationId,EnteredBy,EnteredDate," +
                         " LastUpdatedBy,LastUpdatedDate,IsDeleted,DeletedDate,DeletedBy) " +
                         " values " +
                         "(@DepartmentName,@DepartmentCode,@OrganizationId,@EnteredBy,@EnteredDate," +
                         "0,null,0,null,0)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, Department);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public List <AcademicProgramVM> GetAcademicProgramList(int organizationId = 0, string programName = "", string programCode = "")
        {
            string sql = " select p.ProgramId, p.ProgramName, p.ProgramCode, p.OrganizationId, o.OrganizationName, p.StartedDate, p.StartedDateBS" +
                         " from ACD_Program p " +
                         " left join MS_Organization o on o.OrganizationId = p.OrganizationId";

            sql += " where 1=1 and p.IsDeleted=0";
            if (organizationId != 0)
            {
                sql += " and p.OrganizationId=" + organizationId;
            }
            if (!string.IsNullOrEmpty(programName))
            {
                sql += " and p.programName like '%" + programName + "%'";
            }
            if (!string.IsNullOrEmpty(programCode))
            {
                sql += " and p.programCode like '%" + programCode + "%'";
            }
            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Query <AcademicProgramVM>(sql).ToList();
                db.Close();
                return(lst);
            }
        }
        public bool UpdateAcademicProgram(ACD_Program program)
        {
            string sql = " Update ACD_Program set  ProgramName=@ProgramName, ProgramCode=@ProgramCode, OrganizationId=@OrganizationId, StartedDate=@StartedDate, StartedDateBS=@StartedDateBS, " +
                         " LastUpdatedBy=@LastUpdatedBy, LastUpdatedDate=@LastUpdatedDate " +
                         " where ProgramId=@ProgramId ";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, program);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool InsertItemUnit(MS_ItemUnit itemunit)
        {
            string sql = " Insert into  MS_ItemUnit ( OrganizationId, ItemId, UnitId, UnitSellingPrice, IsDefault, QuantityInPiece, " +
                         " EnteredBy, EnteredDate, LastUpdatedBy, LastUpdatedDate,IsDeleted, DeletedBy,DeletedDate) " +
                         " values " +
                         "( @OrganizationId, @ItemId, @UnitId, @UnitSellingPrice, @IsDefault, @QuantityInPiece, " +
                         " @EnteredBy, @EnteredDate, 0, null,0, 0,null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, itemunit);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#7
0
        public List <Basic> GetStudentList(int orgid, int batch, int classid, int section)
        {
            string sql = " Select StudentId Id,'['+StudentRegNo+'] - '+StudentName Name from ACD_Student";

            sql += " where 1=1 and IsDeleted=0";
            if (orgid != 0)
            {
                sql += " and OrganizationId=" + orgid;
            }
            if (batch != 0)
            {
                sql += " and BatchId=" + batch;
            }
            if (classid != 0)
            {
                sql += " and CurrentClassId=" + classid;
            }
            if (section != 0)
            {
                sql += " and CurrentSectionId=" + section;
            }
            sql += "Order By StudentName";
            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Query <Basic>(sql).ToList();
                db.Close();
                return(lst);
            }
        }
        public bool UpdateAcademicStudent(ACD_Student aclass)
        {
            string sql = " Update ACD_Student set StudentName=@StudentName, StudentCode=@StudentCode, StudentRegNo=@StudentRegNo,Gender=@Gender,OrganizationId=@OrganizationId,BatchId=@BatchId, " +
                         " ClassId=@ClassId , SectionId=@SectionId, CurrentClassId=@CurrentClassId, CurrentSectionId=@CurrentSectionId, AdmissionYear=@AdmissionYear ," +
                         "  TemporaryAddress=@TemporaryAddress, PermanentAddress=@PermanentAddress, Phone=@Phone, DOB=@DOB, DOBBS=@DOBBS, FatherName=@FatherName , FatherContact=@FatherContact," +
                         " MotherName=@MotherName, MotherContact=@MotherContact, LastUpdatedBy=@LastUpdatedBy , LastUpdatedDate=@LastUpdatedDate" +
                         " where StudentId=@StudentId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, aclass);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool InsertAcademicStudent(ACD_Student student)
        {
            string sql = " Insert into  ACD_Student (StudentName, StudentCode, StudentRegNo,Gender,OrganizationId,BatchId, " +
                         "ClassId , SectionId, CurrentClassId, CurrentSectionId, AdmissionYear ," +
                         "  TemporaryAddress, PermanentAddress, Phone, DOB, DOBBS, FatherName , FatherContact," +
                         " MotherName, MotherContact, EnteredBy ," +
                         " EnteredDate, LastUpdatedBy , LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " +
                         " values " +
                         "(@StudentName, @StudentCode, @StudentRegNo,@Gender,@OrganizationId,@BatchId," +
                         " @ClassId , @SectionId, @CurrentClassId, @CurrentSectionId, @AdmissionYear ," +
                         " @TemporaryAddress, @PermanentAddress, @Phone, @DOB, @DOBBS, @FatherName , @FatherContact," +
                         " @MotherName, @MotherContact, @EnteredBy ," +
                         " @EnteredDate, 0 , null, 0, 0, null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, student);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#10
0
        public List <UnitVM> GetUnitList(int organizationId = 0, string unitName = "", string unitCode = "")
        {
            string sql = " select b.UnitId, b.UnitName, b.UnitCode,b.OrganizationId,o.OrganizationName " +
                         " from MS_Unit b " +
                         " left join MS_Organization o on o.OrganizationId = b.OrganizationId";

            //" left join ACD_Program p on p.ProgramId = b.ProgramId ";
            sql += " where 1=1 and b.IsDeleted=0";
            if (organizationId != 0)
            {
                sql += " and b.OrganizationId=" + organizationId;
            }
            if (!string.IsNullOrEmpty(unitName))
            {
                sql += " and b.UnitName like '%" + unitName + "%'";
            }
            if (!string.IsNullOrEmpty(unitCode))
            {
                sql += " and b.UnitCode like '%" + unitCode + "%'";
            }
            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Query <UnitVM>(sql).ToList();
                db.Close();
                return(lst);
            }
        }
示例#11
0
        public bool UpdateUnit(MS_Unit unit)
        {
            string sql = " Update MS_Unit set UnitName=@UnitName, UnitCode=@UnitCode, " +
                         " OrganizationId=@OrganizationId, " +
                         " EnteredBy=@EnteredBy, EnteredDate=@EnteredDate,LastUpdatedBy=@LastUpdatedBy, " +
                         " LastUpdatedDate=@LastUpdatedDate, IsDeleted=0, DeletedBy=0, DeletedDate=null" +
                         " where UnitId=@UnitId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, unit);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#12
0
        public bool UpdateAcademicClass(ACD_Class aclass)
        {
            string sql = " Update ACD_Class set ClassName=@ClassName, ClassCode=@ClassCode, " +
                         " OrganizationId=@OrganizationId, " +
                         " EnteredBy=@EnteredBy, EnteredDate=@EnteredDate,LastUpdatedBy=@LastUpdatedBy, " +
                         " LastUpdatedDate=@LastUpdatedDate, IsDeleted=0, DeletedBy=0, DeletedDate=null" +
                         " where ClassId=@ClassId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, aclass);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#13
0
        //public ACD_Class GetAcademicClassById(int classId)
        //{
        //    string sql = " Select *  from ACD_Class where ClassId=" + classId;
        //    using (var db = DbHelper.GetDBConnection())
        //    {
        //        var lst = db.Query<ACD_Class>(sql).SingleOrDefault();
        //        db.Close();
        //        return lst;
        //    }
        //}

        public bool InsertAcademicClass(ACD_Class aclass)
        {
            string sql = " Insert into  ACD_Class (ClassName, ClassCode,OrganizationId, EnteredBy, EnteredDate," +
                         " LastUpdatedBy, LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " +
                         " values " +
                         "(@ClassName, @ClassCode,@OrganizationId, @EnteredBy, @EnteredDate," +
                         " 0, null, 0, 0, null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, aclass);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#14
0
        public bool UpdateKVendor(K_Vendor a)
        {
            string sql = " Update KI_Vendor set VendorName=@VendorName, Address=@Address,Phone=@Phone,Mobile=@Mobile,PanNo=@PanNo, " +
                         " OrganizationId=@OrganizationId, " +
                         " LastUpdatedBy=@LastUpdatedBy, " +
                         " LastUpdatedDate=@LastUpdatedDate" +// IsDeleted=0, DeletedBy=0, DeletedDate=null" +
                         " where VendorId=@VendorId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, a);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#15
0
        public AssetVM GetAssetDetail(int id = 0)
        {
            string sql = "select  fa.AssetId,ai.AssetCategoryId,ac.CategoryName, fa.AssetItemId, ai.AssetName, fa.PurchaseId, fa.BillDate, fa.BillDateBs, fa.BillNo, fa.OpeningValue," +
                         "  fa.PurchaseValue, fa.AssetUniqueCode, fa.Barcode, fa.OrganizationId, o.OrganizationName, fa.BranchId," +
                         "   b.BranchName, fa.LocationId, l.LocationName, fa.Description , fa.UsefulLife, fa.IsAccessory," +
                         "    fa.AccessoryForAssetId, ffa.AssetUniqueCode AccessoryForAssetName, fa.IsDepreciationApplicable , dm.MethodName DepreciationName," +
                         "     fa.DepreciationStartDate, fa.DepreciationRemarks, fa.IsSold, fa.SoldDate, fa.SoldValue, fa.IsScrap, " +
                         " 	fa.ScrapDate, fa.ScrapRealizedValue" +
                         "     from FA_Asset fa " +
                         "     left join FA_AssetItem ai on ai.AssetItemId = fa.AssetItemId" +
                         "     left join FA_AssetCategory ac on ac.AssetCategoryId = ai.AssetCategoryId" +
                         "     left join MS_Organization o on o.OrganizationId = fa.OrganizationId" +
                         "     left join FA_Branch b on b.BranchId = fa.BranchId" +
                         "     left join FA_Location l on l.LocationId = fa.LocationId" +
                         "     left join FA_Asset ffa on ffa.AssetId = fa.AccessoryForAssetId" +
                         "     left join FA_DepreciationMethod dm on dm.MethodId = ac.DepreciationMethodId";

            sql += " where 1=1 and ai.IsDeleted=0";
            if (id != 0)
            {
                sql += " and fa.AssetId=" + id;
            }

            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Query <AssetVM>(sql).SingleOrDefault();
                db.Close();
                return(lst);
            }
        }
示例#16
0
        public bool InsertAcademicTeacher(ACD_Staff Teacher)
        {
            string sql = " Insert into  ACD_Staff (StaffName,StaffCode,OrganizationId,TemporaryAddress,PermanentAddress,Mobile," +
                         "Email,CitizenshipNo,JoinDate,JoinDateBS,DOB,DOBBS,Photo,EnteredBy,EnteredDate,LastUpdatedBy,LastUpdatedDate,IsDeleted," +
                         "DeletedBy,DeletedDate) " +
                         " values " +
                         "(@StaffName,@StaffCode,@OrganizationId,@TemporaryAddress,@PermanentAddress,@Mobile," +
                         "@Email,@CitizenshipNo,@JoinDate,@JoinDateBS,@DOB,@DOBBS,@Photo,@EnteredBy,@EnteredDate,0,null,0," +
                         "0,null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, Teacher);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#17
0
        public bool InsertAcademicYear(MS_AcademicYear year)
        {
            string sql = " Insert into  MS_AcademicYear (AcademicYearName,StartDate,EndDate,IsCurrent,EnteredBy,EnteredDate,LastUpdatedBy,LastUpdatedDate," +
                         "IsDeleted,DeletedBy,DeletedDate) " +
                         " values " +
                         "(@AcademicYearName,@StartDate,@EndDate,@IsCurrent,@EnteredBy,@EnteredDate,0,null,0,0,null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, year);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#18
0
        public bool UpdateAcademicTeacher(ACD_Staff teacher)
        {
            string sql = " Update ACD_Staff set StaffName=@StaffName,StaffCode=@StaffCode,OrganizationId=@OrganizationId,TemporaryAddress=@TemporaryAddress,PermanentAddress=@PermanentAddress,Mobile=@Mobile," +
                         " Email=@Email,CitizenshipNo=@CitizenshipNo,JoinDate=@JoinDate,JoinDateBS=@JoinDateBS,DOB=@DOB,DOBBS=@DOBBS,Photo=@Photo,LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate" +
                         " where StaffId=@StaffId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, teacher);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#19
0
        public bool UpdateItemUnit(MS_ItemUnit itemunit)
        {
            string sql = " Update MS_ItemUnit set  OrganizationId=@OrganizationId, ItemId=@ItemId, UnitId=@UnitId, UnitSellingPrice=@UnitSellingPrice, IsDefault=@IsDefault, QuantityInPiece=@QuantityInPiece, " +
                         " LastUpdatedBy=@LastUpdatedBy, LastUpdatedDate=@LastUpdatedDate,IsDeleted=0" +
                         " where ItemUnitId=@ItemUnitId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, itemunit);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool UpdateAssetTransfer(FA_AssetTransfer item)
        {
            string sql = " Update FA_AssetTransfer set  AssetId=@AssetId,OrganizationId=@OrganizationId , BranchId=@BranchId ," +
                         " LocationId=@LocationId , LastUpdatedBy=@LastUpdatedBy , LastUpdatedDate=@LastUpdatedDate, Remarks=@Remarks, " +
                         " TransferDate=@TransferDate, TransferDateBS=@TransferDateBS, AssignedTo=@AssignedTo,AssignedDate=@AssignedDate" +
                         " where AssetTransferId= @AssetTransferId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, item);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool InsertAssetCategory(FA_AssetCategory category)
        {
            string sql = " Insert into  FA_AssetCategory ( CategoryName, CategoryCode, DepreciationMethodId, DepreciationRate, OrganizationId, " +
                         " EnteredBy, EnteredDate, LastUpdatedBy, LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " +
                         " values " +
                         "( @CategoryName, @CategoryCode, @DepreciationMethodId, @DepreciationRate, @OrganizationId," +
                         "  @EnteredBy, @EnteredDate, 0, null, 0,0, null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, category);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public List <AssetTransferVM> GetAssetTransferHistory(int id)
        {
            string sql = "select atr.AssetTransferId,ai.AssetName,o.OrganizationName,b.branchName, l.LocationName, u.FullName,atr.TransferDate,atr.TransferDateBS from FA_AssetTransfer atr" +
                         " left join MS_Organization o on o.OrganizationId = atr.OrganizationId" +
                         " left join FA_Branch b on b.BranchId = atr.BranchId" +
                         " left join fa_location l on l.locationId = atr.locationId" +
                         " left join SC_User u on u.UserId = atr.AssignedTo" +
                         " left join fa_asset a on a.AssetId = atr.AssetId" +
                         " left join FA_AssetItem ai on ai.AssetItemId = a.AssetItemId";

            sql += " where 1=1 and atr.IsDeleted=0 and a.AssetId=" + id;
            sql += " Order by atr.EnteredDate desc";
            //if (orgid != 0)
            //    sql += " and fa.OrganizationId=" + orgid;

            //if (assetitemid != 0)
            //    sql += " and fa.assetitemid=" + assetitemid;

            using (var db = DbHelper.GetDBConnection())
            {
                var lst = db.Query <AssetTransferVM>(sql).ToList();
                db.Close();
                return(lst);
            }
        }
        public bool InsertAcademicProgram(ACD_Program program)
        {
            string sql = " Insert into  ACD_Program ( ProgramName, ProgramCode, OrganizationId, StartedDate, StartedDateBS, " +
                         " EnteredBy, EnteredDate, LastUpdatedBy, LastUpdatedDate, IsDeleted, DeletedBy, DeletedDate) " +
                         " values " +
                         "( @ProgramName, @ProgramCode, @OrganizationId, @StartedDate, @StartedDateBS, " +
                         " @EnteredBy, @EnteredDate, 0, null, 0, 0, null)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, program);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool InsertAssetTransfer(FA_AssetTransfer item)
        {
            string sql = " Insert into  FA_AssetTransfer (AssetId,OrganizationId,BranchId,LocationId," +
                         " TransferDate,TransferDateBS,Remarks,AssignedTo,AssignedDate,IsReceived,ReceivedBy,ReceivedDate," +
                         " EnteredBy , EnteredDate , LastUpdatedBy ,  LastUpdatedDate ,  IsDeleted , DeletedBy , DeletedDate,IsTransfered,CategoryId) " +
                         " values (" +
                         "@AssetId,@OrganizationId, @BranchId, @LocationId , " +
                         " @TransferDate,@TransferDateBS,@Remarks,@AssignedTo,@AssignedDate,0,0,null," +
                         " @EnteredBy , @EnteredDate , 0 ,  null ,  0 , 0 , null,@IsTransfered,@CategoryId)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, item);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#25
0
        public List <InventoryPurchaseVM> GetPurchaseList(int organizationId, string fromdate, string todate, string billno, int vendorId)
        {
            string sql = "select pb.PurchaseId ,pb.VendorId,v.VendorName, pb.BillNo, pb.BillDate, pb.BillDateBS, pb.TotalAmount,pb.IsPreviousStock," +
                         " pb.VatApplicable, pb.VatAmount,pb.VATPercent, pb.ShippingCharge, pb.DiscountAmount, pb.TotalWithVat, " +
                         " pb.OrganizationId, pb.IsVerified, pb.VerifiedBy,  u.FullName VerifiedByName" +
                         " from INV_PurchaseBill pb " +
                         " left join INV_Vendor v on v.VendorId = pb.VendorId" +
                         " left join SC_User u on u.UserId = pb.VerifiedBy " +
                         " where 1 = 1 and pb.IsDeleted = 0 and pb.OrganizationId=" + organizationId;

            if (!string.IsNullOrEmpty(fromdate))
            {
                sql += " and pb.EnteredDate >='" + fromdate + "'";
            }
            if (!string.IsNullOrEmpty(todate))
            {
                sql += " and pb.EnteredDate <='" + todate + "'";
            }
            if (!string.IsNullOrEmpty(billno))
            {
                sql += " and pb.BillNo like '%" + billno + "%'";
            }
            if (vendorId > 0)
            {
                sql += " and pb.VendorId =" + vendorId;
            }
            sql += " Order By pb.EnteredDate asc";
            using (var db = DbHelper.GetDBConnection())
            {
                return(db.Query <InventoryPurchaseVM>(sql).ToList());
            }
        }
示例#26
0
        public bool InsertAsset(FA_Asset item, string AssetUniqueCode3)
        {
            string sql = " Insert into  FA_Asset ( AssetItemId,PurchaseId, BillDate, BillDateBs , BillNo , OpeningValue, PurchaseValue, AssetUniqueCode,Barcode," +
                         " OrganizationId , BranchId ,  LocationId ,  Description ,  UsefulLife ,  AccessoryForAssetId ,  IsAccessory ,  IsDepreciationApplicable ," +
                         " DepreciationStartDate ,  DepreciationRemarks , IsSold , SoldDate ,  SoldValue , IsScrap , ScrapDate , ScrapRealizedValue ," +
                         " EnteredBy , EnteredDate , LastUpdatedBy ,  LastUpdatedDate ,  IsDeleted , DeletedBy , DeletedDate, CategoryId) " +
                         " values " +
                         "( @AssetItemId,@PurchaseId, @BillDate, @BillDateBs , @BillNo , @OpeningValue, @PurchaseValue,'" + AssetUniqueCode3 + "',@Barcode," +
                         " @OrganizationId , @BranchId ,  @LocationId ,  @Description ,  @UsefulLife ,  @AccessoryForAssetId ,  @IsAccessory ,  @IsDepreciationApplicable ," +
                         " @DepreciationStartDate ,  @DepreciationRemarks , @IsSold , @SoldDate ,  @SoldValue , @IsScrap , @ScrapDate , @ScrapRealizedValue ," +
                         " @EnteredBy , @EnteredDate , 0 ,  null ,  0 , 0 , null ,@CategoryId)";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, item);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#27
0
        public bool UpdateCategory(MS_Category category)
        {
            string sql = " Update MS_Category set CategoryName=@CategoryName,CategoryCode=@CategoryCode,OrganizationId=@OrganizationId," +
                         " LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate" +
                         " where CategoryId=@CategoryId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, category);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#28
0
        public bool UpdateAsset(FA_Asset item)
        {
            string sql = " Update FA_Asset set  AssetItemId=@AssetItemId,PurchaseId=@PurchaseId, BillDate=@BillDate," +
                         " BillDateBs=@BillDateBs , BillNo=@BillNo , OpeningValue=@OpeningValue, PurchaseValue=@PurchaseValue, " +
                         " AssetUniqueCode=@AssetUniqueCode, Barcode=@Barcode, OrganizationId=@OrganizationId , BranchId=@BranchId ," +
                         " LocationId=@LocationId ,  Description=@Description ,  UsefulLife=@UsefulLife ,  AccessoryForAssetId=@AccessoryForAssetId ," +
                         " IsAccessory=@IsAccessory ,  IsDepreciationApplicable=@IsDepreciationApplicable , DepreciationStartDate=@DepreciationStartDate ," +
                         " DepreciationRemarks=@DepreciationRemarks , IsSold=@IsSold , SoldDate=@SoldDate ,  SoldValue=@SoldValue , IsScrap=@IsScrap ," +
                         " ScrapDate=@ScrapDate , ScrapRealizedValue=@ScrapRealizedValue ,LastUpdatedBy=@LastUpdatedBy , " +
                         " LastUpdatedDate=@LastUpdatedDate " +
                         " where AssetId= @AssetId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, item);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
        public bool UpdateDepartment(MS_Department Department)
        {
            string sql = " Update MS_Department set DepartmentName=@DepartmentName,DepartmentCode=@DepartmentCode,OrganizationId=@OrganizationId," +
                         " LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate" +
                         " where DepartmentId=@DepartmentId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, Department);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }
示例#30
0
        public bool UpdateUser(SC_User user)
        {
            string sql = " Update SC_User set  FullName=@FullName,Email=@Email, Password=@Password," +
                         " OrganizationId=@OrganizationId,IsAdmin=@IsAdmin,IsActive=@IsActive, " +
                         " LastUpdatedBy=@LastUpdatedBy,LastUpdatedDate=@LastUpdatedDate " +
                         " where UserId= @UserId";

            using (var db = DbHelper.GetDBConnection())
            {
                using (var trsn = new TransactionScope())
                {
                    //db.Execute(sql);
                    var lst = db.Execute(sql, user);
                    trsn.Complete();
                    db.Close();
                    if (lst > 0)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
        }