Exemplo n.º 1
0
        public void SaveBankAccount(ref CustomList<CmnBankAccount> BankAccountList)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
               Boolean blnTranStarted = false;

               try
               {
               conManager.BeginTransaction();

               ReSetSPName(BankAccountList);
               Int32 accountID = BankAccountList[0].AccountID;
               blnTranStarted = true;
               if (BankAccountList[0].IsAdded)
                   accountID = Convert.ToInt32(conManager.InsertData(blnTranStarted, BankAccountList));
               else
                   conManager.SaveDataCollectionThroughCollection(blnTranStarted, BankAccountList);

               BankAccountList.AcceptChanges();

               conManager.CommitTransaction();
               blnTranStarted = false;
               }
               catch (Exception Ex)
               {
               conManager.RollBack();
               throw Ex;
               }
               finally
               {
               if (conManager.IsNotNull())
               {
                   conManager.Dispose();
               }
               }
        }
        public void SaveCmnDocListTableMapping(ref CustomList<CmnDocListTableMapping> CmnDocListTableMappingList)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(CmnDocListTableMappingList);
                Int64 TransactionTypeKey = CmnDocListTableMappingList[0].DocListTableMappingID;
                blnTranStarted = true;
                if (CmnDocListTableMappingList[0].IsAdded)
                    TransactionTypeKey = Convert.ToInt64(conManager.InsertData(blnTranStarted, CmnDocListTableMappingList));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnDocListTableMappingList);

                CmnDocListTableMappingList.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 3
0
        public void SaveWorkFlow(ref CustomList<CmnWorkFlowMaster> CmnWorkFlowMasterList, ref CustomList<CmnWorkFlowDetail> CmnWorkFlowDetailList)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(CmnWorkFlowMasterList, CmnWorkFlowDetailList);
                  workFlowID = CmnWorkFlowMasterList[0].WorkFlowID;
                blnTranStarted = true;
                if (CmnWorkFlowMasterList[0].IsAdded)
                    workFlowID = Convert.ToInt32(conManager.InsertData(blnTranStarted, CmnWorkFlowMasterList));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnWorkFlowMasterList);

                CmnWorkFlowDetailList.ForEach(x => x.WorkFlowID = workFlowID);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, CmnWorkFlowDetailList);

                CmnWorkFlowMasterList.AcceptChanges();
                CmnWorkFlowDetailList.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 4
0
        public void SaveBank(ref CustomList<Gen_Bank> BankMasterList, ref CustomList<Bank_Branch> BankBranchList)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(BankMasterList, BankBranchList);
                Int32 bankKey = BankMasterList[0].BankKey;
                blnTranStarted = true;
                if (BankMasterList[0].IsAdded)
                    bankKey = Convert.ToInt32(conManager.InsertData(blnTranStarted, BankMasterList));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, BankMasterList);
                var bankBranch = (CustomList<Bank_Branch>)BankBranchList;
                bankBranch.ForEach(x => x.BankKey = bankKey);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, bankBranch);

                BankMasterList.AcceptChanges();
                BankBranchList.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 5
0
        public void SaveItemSegment(ref CustomList<SegmentNames> lstSegmentNames, ref CustomList<SegmentValues> lstSegmentValues)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(lstSegmentNames, lstSegmentValues);
                Int32 SegNameID = lstSegmentNames[0].SegNameID;
                blnTranStarted = true;
                if (lstSegmentNames[0].IsAdded)
                    SegNameID = Convert.ToInt32(conManager.InsertData(blnTranStarted, lstSegmentNames));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstSegmentNames);
                var SegmentValues = (CustomList<SegmentValues>)lstSegmentValues;
                SegmentValues.ForEach(x => x.SegNameID = SegNameID);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, SegmentValues);

                lstSegmentNames.AcceptChanges();
                lstSegmentValues.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
        public void SaveDocListFormat(ref CustomList<CmnDocListFormat> DocListFormatList, ref CustomList<CmnDocListFormatDetail> DocListFormatDetailList)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(DocListFormatList, DocListFormatDetailList);
                Int32 docListFormatKey = DocListFormatList[0].DocListFormatID;
                blnTranStarted = true;
                if (DocListFormatList[0].IsAdded)
                    docListFormatKey = Convert.ToInt32(conManager.InsertData(blnTranStarted, DocListFormatList));
                 else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, DocListFormatList);
                var docListFormatDetail = (CustomList<CmnDocListFormatDetail>)DocListFormatDetailList;
                docListFormatDetail.ForEach(x => x.DocListFormatID = docListFormatKey);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, docListFormatDetail);

                DocListFormatList.AcceptChanges();
                DocListFormatDetailList.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 7
0
        public void SaveStockTransaction(ref CustomList<StockTransactionMaster> lstStockTransactionMaster, ref CustomList<StockTransactionDetail> lstStockTransactionDetail)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(lstStockTransactionMaster, lstStockTransactionDetail);
                GetNewStockTransaction(ref conManager, ref lstStockTransactionMaster);
                Int64 StockTransID = lstStockTransactionMaster[0].StockTransID;
                blnTranStarted = true;
                if (lstStockTransactionMaster[0].IsAdded)
                    StockTransID = Convert.ToInt32(conManager.InsertData(blnTranStarted, lstStockTransactionMaster));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstStockTransactionMaster);
                lstStockTransactionDetail.ForEach(x => x.StockTransID = StockTransID);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstStockTransactionDetail);

                lstStockTransactionMaster.AcceptChanges();
                lstStockTransactionDetail.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 8
0
        public void SaveHKEntry(ref CustomList<HouseKeepingValue> HKList, ref CustomList<HousekeepingHierarchy> lstChild)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(HKList, lstChild);

                blnTranStarted = true;

                Int32 HKID = HKList[0].HKID;
                blnTranStarted = true;
                if (HKList[0].IsAdded)
                    HKID = Convert.ToInt32(conManager.InsertData(blnTranStarted, HKList));
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, HKList);
                lstChild.ForEach(x => x.HKID = HKID);
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, lstChild);

                HKList.AcceptChanges();
                lstChild.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
                conManager.Dispose();
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 9
0
        public void SaveContactInfo(ref CustomList<ContactInfo> ContactInfoList, ref CustomList<ContactType> ContactTypeList, ref CustomList<ContactTypeChild> ContactTypeChildList, ref CustomList<ContactDetail> lstContactDetail)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                conManager.BeginTransaction();

                ReSetSPName(ContactInfoList, ContactTypeList, ContactTypeChildList);
                Int32 contactID = ContactInfoList[0].ContactID;
                blnTranStarted = true;
                if (ContactInfoList[0].IsAdded)
                {
                    contactID = Convert.ToInt32(conManager.InsertData(blnTranStarted, ContactInfoList));
                    ContactInfoList[0].ContactID = contactID;
                }
                else
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, ContactInfoList);

                foreach (ContactType cT in ContactTypeList)
                {
                    CustomList<ContactType> ContactType_List = new CustomList<ContactType>();
                    if (cT.IsAdded)
                    {
                        Int32 contactTypeID = 0;
                        ContactType_List.Add(cT);
                        ContactType_List.InsertSpName = "spInsertContactType";
                        contactTypeID = Convert.ToInt32(conManager.InsertData(blnTranStarted, ContactType_List));
                        cT.ContactTypeID = contactTypeID;
                    }
                    if (cT.IsModified)
                    {
                        cT.SetModified();
                        ContactType_List.Add(cT);
                        ContactType_List.UpdateSpName = "spUpdateContactType";
                        conManager.SaveDataCollectionThroughCollection(blnTranStarted, ContactType_List);
                    }
                }
                CustomList<ContactDetail> ContactDetailList = new CustomList<ContactDetail>();
                foreach (ContactType cT in ContactTypeList)
                {
                    if (cT.IsChecked)
                    {
                        ContactDetail contactDetail = new ContactDetail();
                        contactDetail.ContactTypeID = cT.ContactTypeID;
                        contactDetail.ContactID = contactID;
                        ContactDetailList.Add(contactDetail);
                    }
                }
                foreach (ContactDetail cD in lstContactDetail)
                {
                    ContactDetail obj = ContactDetailList.Find(f => f.ContactTypeID == cD.ContactTypeID);
                    if (obj.IsNotNull())
                        obj.SetModified();
                    else
                    {
                        cD.Delete();
                        ContactDetailList.Add(cD);
                    }

                }

                ReSetSPName(ContactDetailList);

                conManager.SaveDataCollectionThroughCollection(blnTranStarted, ContactDetailList);

                ContactInfoList.AcceptChanges();
                ContactTypeList.AcceptChanges();
                ContactTypeChildList.AcceptChanges();
                ContactDetailList.AcceptChanges();

                conManager.CommitTransaction();
                blnTranStarted = false;
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    conManager.Dispose();
                }
            }
        }
Exemplo n.º 10
0
        //End
        //Search Voucher
        //public CustomList<Acc_Voucher> GetAllAcc_VoucherSearch(string searchStr, string blank)
        //{
        //    return Acc_Voucher.GetAllAcc_VoucherSearch(searchStr, blank);
        //}
        //end
        public void SavePFVoucher(ref CustomList<Acc_Voucher> AccVoucherList, ref CustomList<Acc_VoucherDet> AccVoucherDetList, string prifix)
        {
            ConnectionManager conManager = new ConnectionManager(ConnectionName.HR);
            Boolean blnTranStarted = false;

            try
            {
                blnTranStarted = true;
                conManager.BeginTransaction();

                ReSetSPName(ref AccVoucherList, ref AccVoucherDetList);
                if (AccVoucherList[0].VoucherNo.IsNullOrEmpty())
                {
                    GetNewVoucherID(ref conManager, blnTranStarted, ref AccVoucherList, prifix);
                }
                else
                {
                    string[] items = AccVoucherList[0].VoucherNo.Split('-');
                    if (prifix != items[0])
                    {
                        string prifix1 = prifix + "-" + items[1];
                        voucherID = prifix1;
                        AccVoucherList[0].VoucherNo = prifix1;
                    }
                    else
                        voucherID = AccVoucherList[0].VoucherNo;
                }
                blnTranStarted = true;

                if (AccVoucherList[0].IsAdded)
                {
                    object scope_Identity = conManager.InsertData(blnTranStarted, AccVoucherList);
                    AccVoucherList[0].VoucherKey = Convert.ToInt64(scope_Identity);
                }
                else
                {
                    conManager.SaveDataCollectionThroughCollection(blnTranStarted, AccVoucherList);
                }
                CustomList<Acc_VoucherDet> AddedVoucherDetList = AccVoucherDetList.FindAll(f => f.IsAdded);
                foreach (Acc_VoucherDet aVD in AddedVoucherDetList)
                {
                    aVD.VoucherKey = AccVoucherList[0].VoucherKey;
                }
                conManager.SaveDataCollectionThroughCollection(blnTranStarted, AccVoucherDetList);

                conManager.CommitTransaction();
                AccVoucherList.AcceptChanges();
                AccVoucherDetList.AcceptChanges();
            }
            catch (Exception Ex)
            {
                conManager.RollBack();
                throw Ex;
            }
            finally
            {
                if (conManager.IsNotNull())
                {
                    blnTranStarted = false;
                    conManager.Dispose();
                }
            }
        }