예제 #1
0
 /// <summary>
 /// Search Header & Detail and return Dataset
 /// </summary>
 /// <param name="xmlDoc"></param>
 /// <param name="spName"></param>
 /// <param name="errorMessage"></param>
 /// <returns></returns>
 public DataSet Search_Header_Detail_DatSet(string xmlDoc, string spName, ref string errorMessage)
 {
     try
     {
         DataTaskManager dt = new DataTaskManager();
         DataSet         ds = new DataSet();
         using (DataTaskManager dtManager = new DataTaskManager())
         {
             DBParameterList dbParam = new DBParameterList();
             dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
             dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
             ds = dtManager.ExecuteDataSet(spName, dbParam);
             {
                 errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();
                 if (errorMessage != string.Empty)
                 {
                     return(null);
                 }
             }
         }
         return(ds);
     }
     catch (Exception ex)
     {
         Common.LogException(ex);
         throw ex;
     }
 }
예제 #2
0
 public DataTable IndentDetailSearchDataTable()
 {
     System.Data.DataSet dSet = new DataSet();
     try
     {
         string          errorMessage = string.Empty;
         string          dbMessage    = string.Empty;
         DBParameterList dbParam      = new DBParameterList();
         dbParam.Add(new DBParameter("@IndentNo", this.IndentNo, DbType.String));
         dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
         using (DataTaskManager dt = new DataTaskManager())
         {
             dSet = dt.ExecuteDataSet(SP_INDENT_DETAIL_SEARCH, dbParam);
             if (dSet == null | dSet.Tables[0].Rows.Count <= 0)
             {
                 return(null);
             }
         }
     }
     catch (Exception ex)
     {
         Common.LogException(ex);
     }
     return(dSet.Tables[0]);
 }
        public DataTable GetIndentDetailForItem(int ItemID)
        {
            List <Item>     lstItemsForConsolidation = new List <Item>();
            DBParameterList dbParam;

            try
            {
                Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager();

                //Declare and initialize the parameter list object.
                dbParam = new DBParameterList();

                //Add the relevant 2 parameters
                dbParam.Add(new DBParameter("@ItemId", ItemID, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                            ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                // executing procedure to save the record
                DataSet ds = dtManager.ExecuteDataSet(SP_APPROVEDITEM_SEARCH, dbParam);

                //Populate the List Item from the grid
                if (ds != null && ds.Tables.Count > 0)
                {
                    return(ds.Tables[0]);
                }
                return(null);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #4
0
        public DataTable GetVendorDetailDataTable(string xmlDoc, string spName, ref string errorMessage)
        {
            try
            {
                DataSet         ds = new DataSet();
                DataTaskManager dt = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        if (errorMessage.Length != 0) //No dbError
                        {
                            return(null);
                        }
                    }
                }

                return(ds.Tables[0]);
            }
            catch (Exception ex)
            {
                Common.LogException(ex);
                throw;
            }
        }
예제 #5
0
        public bool CheckForValidReturnQty(string xmlDoc, ref string errorMessage)
        {
            bool isValid = true;

            System.Globalization.NumberFormatInfo nfi = new System.Globalization.NumberFormatInfo();
            nfi.PercentDecimalDigits = Common.DisplayAmountRounding;
            string strRoundingZeroesFormat = Common.GetRoundingZeroes(Common.DisplayQtyRounding); //"0.00";

            DataTaskManager dtDataMgr = new DataTaskManager();

            using (DataTaskManager dtManager = new DataTaskManager())
            {
                DBParameterList dbParam = new DBParameterList();
                dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                using (DataSet ds = dtDataMgr.ExecuteDataSet(SP_CHECK_RET_QTY, dbParam))
                {
                    string tempErrCode = dbParam[Common.PARAM_OUTPUT].Value.ToString();
                    if (!string.IsNullOrEmpty(tempErrCode))
                    {
                        //errorMessage = Common.GetMessage(tempErr);
                        DataTable dtTemp       = ds.Tables[0];
                        decimal   totGRNRecQty = Convert.ToDecimal(dtTemp.Rows[0]["TotalRemainingQty"].ToString());
                        errorMessage = Common.GetMessage(tempErrCode, totGRNRecQty.ToString(strRoundingZeroesFormat, nfi));
                        isValid      = false;
                    }
                }
            }

            return(isValid);
        }
예제 #6
0
        public List <RetVendorDetails> GetVendorDetail(string xmlDoc, string spName, ref string errorMessage)
        {
            List <RetVendorDetails> listDeatil;

            try
            {
                listDeatil = new List <RetVendorDetails>();
                DataTaskManager dt = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError
                        {
                            foreach (DataRow drDeatils in ds.Tables[0].Rows)
                            {
                                RetVendorDetails obj = new RetVendorDetails();

                                obj.BatchNo         = Convert.ToString(drDeatils["BatchNo"]);
                                obj.ItemDescription = Convert.ToString(drDeatils["ItemName"]);
                                obj.ItemCode        = Convert.ToString(drDeatils["ItemCode"]);
                                obj.PODate          = Convert.ToDateTime(drDeatils["PODate"]).ToString(Common.DATE_TIME_FORMAT);
                                //obj.DisplayPODate = Convert.ToDateTime(drDeatils["PODate"]).ToString(Common.DTP_DATE_FORMAT);
                                obj.ItemId       = Convert.ToInt32(drDeatils["ItemId"]);
                                obj.POQty        = Convert.ToDouble(drDeatils["POQty"]);
                                obj.ReturnQty    = Convert.ToInt32(drDeatils["ReturnQty"]);
                                obj.PONumber     = Convert.ToString(drDeatils["PONumber"]);
                                obj.ReturnReason = Convert.ToString(drDeatils["ReturnReason"]);
                                obj.Bucket       = Convert.ToString(drDeatils["Bucket"]);
                                obj.BucketId     = Convert.ToInt32(drDeatils["BucketId"]);
                                obj.AvailableQty = Convert.ToInt32(drDeatils["AvailableQty"]);
                                obj.POAmount     = Convert.ToDouble(drDeatils["POAmount"]);

                                obj.GRNInvoiceNumber   = drDeatils["GRNInvoiceNo"].ToString();
                                obj.GRNReceivedQty     = Convert.ToDouble(drDeatils["GRNReceivedQty"]);
                                obj.GRNInvoiceType     = Convert.ToInt32(drDeatils["GRNInvoiceType"]);
                                obj.LineTaxAmount      = Convert.ToDecimal(drDeatils["LineTaxAmount"]);
                                obj.ManufactureBatchNo = drDeatils["ManufactureBatchNo"].ToString();

                                listDeatil.Add(obj);
                            }
                        }
                    }
                }
                return(listDeatil);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #7
0
 public List <IndentDetail> GetIndentDetail()
 {
     try
     {
         List <IndentDetail> _indentDetailList = new List <IndentDetail>();
         string          dbMessage             = string.Empty;
         DBParameterList dbParam = new DBParameterList();
         dbParam.Add(new DBParameter("@IndentNo", this.IndentNo, DbType.String));
         dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
         using (DataTaskManager dt = new DataTaskManager())
         {
             System.Data.DataSet dSet = new DataSet();
             dSet = dt.ExecuteDataSet(SP_GET_INDENT_DETAIL, dbParam);
             if (dbMessage.Trim().Equals(string.Empty) && dSet != null && dSet.Tables.Count > 0 && dSet.Tables[0].Rows.Count > 0)
             {
                 foreach (DataRow dr in dSet.Tables[0].Rows)
                 {
                     IndentDetail detail = new IndentDetail();
                     detail.CreateIndentDetailObject(dr);
                     detail.GetPONO(dSet.Tables[1]);
                     detail.GetTONO(dSet.Tables[2]);
                     _indentDetailList.Add(detail);
                 }
             }
         }
         return(_indentDetailList);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #8
0
 public static POSItem Search(string itemBarcode, string locationCode, bool isKitOrder, int isFirstOrder, ref string dbMessage)
 {
     try
     {
         POSItem         item        = null;
         DBParameterList dbParamList = new DBParameterList();
         List <POSItem>  itemList    = new List <POSItem>();
         dbParamList.Add(new DBParameter("@itemBarcode", itemBarcode, DbType.String));
         dbParamList.Add(new DBParameter("@inputParam", locationCode, DbType.String));
         dbParamList.Add(new DBParameter("@isKitOrder", isKitOrder, DbType.Boolean));
         dbParamList.Add(new DBParameter("@isFirstOrder", isFirstOrder, DbType.Int32));
         dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
         using (DataTaskManager dtManager = new DataTaskManager())
         {
             DataSet ds = dtManager.ExecuteDataSet(SP_BarcodeItems_Search, dbParamList);
             if (ds != null)
             {
                 DataRow[] rows = ds.Tables[0].Select();
                 item = CreateItem(rows[0]);
             }
         }
         return(item);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
예제 #9
0
        public void getFromLocationStock(int Locationid, int ItemId)
        {
            System.Data.DataSet dSet = new DataSet();
            try
            {
                string          errorMessage = string.Empty;
                string          dbMessage    = string.Empty;
                DBParameterList dbParam      = new DBParameterList();
                dbParam.Add(new DBParameter("@Locationid", Locationid, DbType.Int16));
                dbParam.Add(new DBParameter("@Itemid", ItemId, DbType.Int16));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, dbMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
                using (DataTaskManager dt = new DataTaskManager())
                {
                    dSet = dt.ExecuteDataSet(SP_ITEMWHLOCATION_STOCKDETAIL, dbParam);
                    if (dSet == null | dSet.Tables[0].Rows.Count <= 0)
                    {
                        return;
                    }

                    this.whLocatinStock = Convert.ToDouble(dSet.Tables[0].Rows[0]["AvailableQuantity"]);
                }
            }
            catch (Exception ex)
            {
                Common.LogException(ex);
            }
        }
예제 #10
0
        /// <summary>
        /// save pack/unpack details
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="spName"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public bool PUSave(string xmlDoc, string spName, ref string errorMessage)
        {
            bool isSuccess = false;

            try
            {
                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    //Declare and initialize the parameter list object
                    DBParameterList dbParam = new DBParameterList();

                    //Add the relevant 2 parameters
                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    try
                    {
                        //Begin the transaction and executing procedure to save the record(s)
                        dtManager.BeginTransaction();

                        // executing procedure to save the record

                        DataSet ds;

                        ds = dtManager.ExecuteDataSet(spName, dbParam);

                        //Update database message
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        //If an error returned from the database
                        if (errorMessage.Length > 0)
                        {
                            dtManager.RollbackTransaction();
                            isSuccess = false;
                        }
                        else
                        {
                            dtManager.CommitTransaction();
                            isSuccess = true;
                        }
                    }
                    catch (Exception ex)
                    {
                        dtManager.RollbackTransaction();
                        throw ex;
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(isSuccess);
        }
예제 #11
0
        public List <RetVendorHeader> GetHeaderDetails(string xmlDoc, string spName, ref string errorMessage)
        {
            try
            {
                List <RetVendorHeader> listRetVendorHeader = new List <RetVendorHeader>();
                DataTaskManager        dt = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError
                        {
                            foreach (DataRow drRetVendorHeader in ds.Tables[0].Rows)
                            {
                                RetVendorHeader objRetVendorHeader = new RetVendorHeader();
                                objRetVendorHeader.ReturnNo      = Convert.ToString(drRetVendorHeader["ReturnNo"]);
                                objRetVendorHeader.RetVendorDate = Convert.ToDateTime(drRetVendorHeader["RetVendorDate"]).ToString(Common.DATE_TIME_FORMAT);
                                //objRetVendorHeader.DisplayRetVendorDate = Convert.ToDateTime(drRetVendorHeader["RetVendorDate"]).ToString(Common.DTP_DATE_FORMAT);
                                objRetVendorHeader.ModifiedDate    = Convert.ToDateTime(drRetVendorHeader["ModifiedDate"]).ToString(Common.DATE_TIME_FORMAT);
                                objRetVendorHeader.LocationId      = Convert.ToInt32(drRetVendorHeader["LocationId"]);
                                objRetVendorHeader.VendorId        = Convert.ToInt32(drRetVendorHeader["VendorId"]);
                                objRetVendorHeader.Remarks         = Convert.ToString(drRetVendorHeader["Remarks"]);
                                objRetVendorHeader.Quantity        = Convert.ToInt32(drRetVendorHeader["Quantity"]);
                                objRetVendorHeader.ShippingDetails = Convert.ToString(drRetVendorHeader["ShippingDetails"]);
                                objRetVendorHeader.ShipmentDate    = drRetVendorHeader["ShipmentDate"].ToString().Trim() == string.Empty ? string.Empty : Convert.ToDateTime(drRetVendorHeader["ShipmentDate"]).ToString(Common.DATE_TIME_FORMAT);
                                objRetVendorHeader.StatusName      = Convert.ToString(drRetVendorHeader["StatusName"]);
                                objRetVendorHeader.StatusId        = Convert.ToInt32(drRetVendorHeader["StatusId"]);
                                objRetVendorHeader.DebitNoteNumber = Convert.ToString(drRetVendorHeader["DebitNoteNumber"]);
                                objRetVendorHeader.DebitNoteAmount = Math.Round(Convert.ToDouble(drRetVendorHeader["DebitNoteAmount"]), 2);
                                objRetVendorHeader.TotalAmount     = Math.Round(Convert.ToDouble(drRetVendorHeader["TotalAmount"]), 2);
                                objRetVendorHeader.VendorName      = Convert.ToString(drRetVendorHeader["VendorName"]);
                                listRetVendorHeader.Add(objRetVendorHeader);
                            }
                        }
                    }
                }

                return(listRetVendorHeader);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #12
0
        /// <summary>
        /// This method returns list of all modules and their
        /// associated functions linked in a 'List of Module' business object.
        /// </summary>
        /// <returns>List of Module business object</returns>
        public List <Module> ModulesFunctionsLink()
        {
            List <Module> lModule = new List <Module>();

            try
            {
                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();
                    using (DataSet dsModFuncLink = dtManager.ExecuteDataSet(GET_APP_MODULE_FUNCTION_LINK, dbParam))
                    {
                        if (dsModFuncLink != null && dsModFuncLink.Tables.Count == 2)
                        {
                            dsModFuncLink.Relations.Add("ModuleFunction",
                                                        dsModFuncLink.Tables[0].Columns["ModuleId"],
                                                        dsModFuncLink.Tables[1].Columns["ModuleId"]);
                            for (int index = 0; index < dsModFuncLink.Tables[0].Rows.Count; index++)
                            {
                                Module tModule = new Module();
                                tModule.ModuleId = Convert.ToInt32(dsModFuncLink.Tables[0].Rows[index]["ModuleId"]);
                                tModule.Name     = Convert.ToString(dsModFuncLink.Tables[0].Rows[index]["ModuleName"]);
                                tModule.Code     = Convert.ToString(dsModFuncLink.Tables[0].Rows[index]["ModuleCode"]);

                                //Module Functions
                                DataRow[] drFunctions;
                                drFunctions = dsModFuncLink.Tables[0].Rows[index].GetChildRows("ModuleFunction");
                                if (drFunctions != null)
                                {
                                    for (int jindex = 0; jindex < drFunctions.Length; jindex++)
                                    {
                                        Function tFunction = new Function();
                                        tFunction.FunctionId = Convert.ToInt32(drFunctions[jindex]["FunctionId"]);
                                        tFunction.Name       = Convert.ToString(drFunctions[jindex]["FunctionName"]);
                                        tFunction.Code       = Convert.ToString(drFunctions[jindex]["FunctionCode"]);
                                        tModule.Functions.Add(tFunction);
                                    }
                                }
                                lModule.Add(tModule);
                            }
                        }
                        else
                        {
                            throw new Exception(Common.GetMessage("2001"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(lModule);
        }
        /// <summary>
        /// Get indent consolidation Data
        /// </summary>
        /// <param name="indentConsolidationRequest"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public DataSet GetIndentConsolidationData(IndentConsolidationRequest indentConsolidationRequest, ref String errorMessage)
        {
            string  SP_NAME = "usp_GetIndentConsolidationData";
            DataSet dsTemp  = new DataSet();

            //Get Items and Warehouse items detail
            using (DataTaskManager dtManager = new DataTaskManager())
            {
                //Declare and initialize the parameter list object.
                DBParameterList dbParam = new DBParameterList();

                //Add the relevant 2 parameters
                dbParam.Add(new DBParameter(Common.PARAM_DATA, Common.ToXml(indentConsolidationRequest), DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                            ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                dsTemp       = dtManager.ExecuteDataSet(SP_NAME, dbParam);
                errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                if (string.IsNullOrEmpty(errorMessage))
                {
                    if (dsTemp.Tables.Count > 0)
                    {
                        if (dsTemp.Tables[0].Rows.Count > 0)
                        {
                            foreach (DataRow drRow in dsTemp.Tables[0].Rows)
                            {
                                if (!string.IsNullOrEmpty(drRow["ApprovedQty"].ToString()))
                                {
                                    drRow["ApprovedQty"] = Math.Round(Convert.ToDouble(drRow["ApprovedQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString();
                                }
                                if (!string.IsNullOrEmpty(drRow["TOIQty"].ToString()))
                                {
                                    drRow["TOIQty"] = Math.Round(Convert.ToDouble(drRow["TOIQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString();
                                }
                                if (!string.IsNullOrEmpty(drRow["POQty"].ToString()))
                                {
                                    drRow["POQty"] = Math.Round(Convert.ToDouble(drRow["POQty"].ToString()), Common.DisplayQtyRounding, MidpointRounding.AwayFromZero).ToString();
                                }
                                if (!string.IsNullOrEmpty(drRow["WarehouseQtySum"].ToString()))
                                {
                                    drRow["WarehouseQtySum"] = Math.Round(Convert.ToDouble(drRow["WarehouseQtySum"].ToString()), Common.DisplayAmountRounding, MidpointRounding.AwayFromZero).ToString();
                                }
                            }
                        }
                    }
                }
            }

            return(dsTemp);
        }
        // Added By Garima (11 Dec 2009)
        public List <Item> GetAppovedItemsForConsolidation()
        {
            List <Item>     lstItemsForConsolidation = new List <Item>();
            DBParameterList dbParam;

            try
            {
                Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager();

                //Declare and initialize the parameter list object.
                dbParam = new DBParameterList();

                //Add the relevant 2 parameters
                dbParam.Add(new DBParameter("@ItemId", -1, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                            ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                // executing procedure to save the record
                DataSet ds = dtManager.ExecuteDataSet(SP_APPROVEDITEM_SEARCH, dbParam);

                //Populate the List Item from the grid
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0] != null)
                    {
                        foreach (DataRow drRow in ds.Tables[0].Rows)
                        {
                            Item tmpApprovedItem = new Item();
                            tmpApprovedItem.ItemId      = Convert.ToInt32(drRow["ITEMID"]);
                            tmpApprovedItem.ItemCode    = drRow["ITEMCODE"].ToString();
                            tmpApprovedItem.ItemName    = drRow["ITEMNAME"].ToString();
                            tmpApprovedItem.Selected    = false;
                            tmpApprovedItem.IsComposite = Convert.ToBoolean(drRow["ISCOMPOSITE"]);
                            tmpApprovedItem.ApprovedQty = Convert.ToDecimal(drRow["APPROVEDQTY"]);
                            lstItemsForConsolidation.Add(tmpApprovedItem);
                        }
                    }
                }
                return(lstItemsForConsolidation);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #15
0
        public DataTable GetPODetails(RetVendorDetails objDetails, string xmlDoc, string spName, ref string errorMessage)
        {
            try
            {
                DataTable       dtVendor = new DataTable();
                DataTaskManager dt       = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError
                        {
                            dtVendor = ds.Tables[0];
                            if (ds.Tables[0].Rows.Count == 1)
                            {
                                objDetails.PODate = Convert.ToDateTime(ds.Tables[0].Rows[0]["PODate"]).ToString(Common.DATE_TIME_FORMAT);
                                //objDetails.DisplayPODate = Convert.ToDateTime(ds.Tables[0].Rows[0]["PODate"]).ToString(Common.DTP_DATE_FORMAT);
                                objDetails.PONumber = Convert.ToString(ds.Tables[0].Rows[0]["PONumber"]);
                                objDetails.POQty    = Convert.ToInt32(ds.Tables[0].Rows[0]["POQty"]);
                                objDetails.POAmount = Convert.ToDouble(ds.Tables[0].Rows[0]["MRP"]);
                            }
                            else
                            {
                            }
                        }
                    }
                }

                return(dtVendor);
            }
            catch (Exception)
            {
                throw;
            }
        }
예제 #16
0
        public static List <POSItem> Search(string locationCode, bool isKitOrder, int isFirstOrder, ref string dbMessage)
        {
            try
            {
                DBParameterList dbParamList = new DBParameterList();
                List <POSItem>  itemList    = new List <POSItem>();
                dbParamList.Add(new DBParameter("@inputParam", locationCode, DbType.String));
                dbParamList.Add(new DBParameter("@isKitOrder", isKitOrder, DbType.Boolean));
                dbParamList.Add(new DBParameter("@isFirstOrder", isFirstOrder, DbType.Int32));
                dbParamList.Add(new DBParameter("@forSkinCareItem", Common.ForSkinCareItem, DbType.Boolean));
                dbParamList.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));
                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DataSet ds = dtManager.ExecuteDataSet(SP_ITEMS_SEARCH, dbParamList);
                    if (ds != null)
                    {
                        if (ds.Tables.Count > 2)
                        {
                            int min = Convert.ToInt32(ds.Tables[0].Rows[0]["Min"]);
                            int max = Convert.ToInt32(ds.Tables[0].Rows[0]["Max"]);

                            DataRow[] rows = ds.Tables[1].Select("Level = " + min);

                            for (int i = 0; i < rows.Length; i++)
                            {
                                POSItem item = CreateItem(rows[i]);
                                AddHierarchyChildren(item, ds, ds.Tables[1], max);
                                if (item.POSItems.Count > 0)
                                {
                                    itemList.Add(item);
                                }
                            }
                        }
                    }
                }
                return(itemList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public DataSet GetCompleteConsolidation(int ConsolidationId)
        {
            //IndentConsolidation consolidation = null;
            string SP_NAME = "usp_GetConsolidationDetail";

            using (DataTaskManager dtManager = new DataTaskManager())
            {
                //Declare and initialize the parameter list object.
                DBParameterList dbParam = new DBParameterList();

                //Add the relevant 2 parameters
                dbParam.Add(new DBParameter("@ConsolidationId", ConsolidationId, DbType.Int32));
                dbParam.Add(new DBParameter("@UnderConsolidation", false, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                DataSet dsTemp       = dtManager.ExecuteDataSet(SP_NAME, dbParam);
                string  errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                //if (string.IsNullOrEmpty(errorMessage) && dsTemp.Tables.Count > 0)
                //{
                //    return dsTemp;
                //    //if (dsTemp.Tables[0].Rows.Count > 0)
                //    //{
                //    //    consolidation = new IndentConsolidation();
                //    //    DataRow dr = dsTemp.Tables[0].Rows[0];
                //    //    consolidation.ConsolidationId = Convert.ToInt32(dr["ConsolidationId"]);
                //    //    consolidation.CreatedDate = Convert.ToString(dr["CreatedDate"]);
                //    //    consolidation.Source = Convert.ToInt32(dr["SourceVal"]);
                //    //    consolidation.SourceCap = Convert.ToString(dr["SourceCap"]);
                //    //    consolidation.Status = Convert.ToInt32(dr["StatusVal"]);
                //    //    consolidation.StatusCap = Convert.ToString(dr["StatusCap"]);
                //    //    consolidation.ModifiedDate = Convert.ToString(dr["ModifiedDate"]);
                //    //}
                //    //if (dsTemp.Tables.Count == 2)
                //    //    dtConsolidationDetail = dsTemp.Tables[1];

                //}
                return(dsTemp);
                //return consolidation;
            }
        }
예제 #18
0
        public virtual DataSet GetSelectedItems(string seqNo, int mode, string spName, ref string errorMessage)
        {
            DBParameterList dbParam;

            try
            {
                Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager();

                // initialize the parameter list object
                dbParam = new DBParameterList();

                // add the relevant 2 parameters
                dbParam.Add(new DBParameter("@ReturnNo", seqNo, DbType.String));
                dbParam.Add(new DBParameter("@Mode", mode, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                // executing procedure to save the record
                DataSet dt = dtManager.ExecuteDataSet(spName, dbParam);

                // update database message
                errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                // if an error returned from the database
                if (errorMessage != string.Empty)
                {
                    return(null);
                }
                else
                {
                    return(dt);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #19
0
        public Promotion Search(string xmlDoc, string spName, ref string errorMessage)
        {
            Promotion       promotion = new Promotion();
            DBParameterList dbParam;

            using (DataTaskManager dtManager = new DataTaskManager())
            {
                dbParam = new DBParameterList();
                dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, errorMessage, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                DataSet ds = dtManager.ExecuteDataSet(spName, dbParam);
                errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                if (ds != null)
                {
                    //Add promotion Master
                    List <PromotionCondition> conditions = new List <PromotionCondition>();

                    //Add list of condition to the promotion object
                    for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                    {
                        PromotionCondition condition = new PromotionCondition(
                            Convert.ToInt32(ds.Tables[1].Rows[i]["PromotionId"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["ConditionId"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["ConditionTypeId"]),
                            Convert.ToString(ds.Tables[1].Rows[i]["ConditionType"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["ConditionOnId"]),
                            Convert.ToString(ds.Tables[1].Rows[i]["ConditionOn"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["ConditionCodeId"]),
                            Validators.CheckForDBNull(ds.Tables[1].Rows[i]["ConditionCode"], string.Empty),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["MinBuyQty"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["MaxBuyQty"]),
                            Validators.CheckForDBNull(ds.Tables[1].Rows[i]["Qty"], (decimal)0),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["DiscountTypeId"]),
                            Validators.CheckForDBNull(Convert.ToString(ds.Tables[1].Rows[i]["DiscountType"]), String.Empty),
                            Convert.ToDecimal(ds.Tables[1].Rows[i]["DiscountValue"]),
                            Convert.ToInt32(ds.Tables[1].Rows[i]["StatusId"]),
                            Convert.ToString(ds.Tables[1].Rows[i]["Status"])
                            );


                        DataRow[] drTiers = ds.Tables[2].Select("ConditionId = " + Convert.ToString(ds.Tables[1].Rows[i]["ConditionId"]));
                        //Add list of tiers to the condition
                        List <PromotionTier> tiers = new List <PromotionTier>();
                        PromotionTier        tier;
                        for (int j = 0; j < drTiers.Length; j++)
                        {
                            tier = new PromotionTier(
                                Convert.ToInt32(drTiers[j]["PromotionId"]),
                                Convert.ToInt32(drTiers[j]["TierId"]),
                                Convert.ToInt32(drTiers[j]["ConditionId"]),
                                Common.INT_DBNULL,
                                Validators.CheckForDBNull(drTiers[j]["ConditionOnId"], Common.INT_DBNULL),
                                Validators.CheckForDBNull(drTiers[j]["ConditionOn"], String.Empty),
                                Validators.CheckForDBNull(drTiers[j]["ConditionCodeId"], Common.INT_DBNULL),
                                Validators.CheckForDBNull(drTiers[j]["ConditionCode"], string.Empty),
                                Convert.ToInt32(drTiers[j]["BuyQtyFrom"]),
                                Convert.ToInt32(drTiers[j]["BuyQtyTo"]),
                                Convert.ToInt32(drTiers[j]["Qty"]),
                                Convert.ToInt32(drTiers[j]["DiscountTypeId"]),
                                Convert.ToString(drTiers[j]["DiscountTypeVal"]),
                                //Convert.ToInt32(drTiers[j]["DiscountValue"]),
                                Convert.ToDecimal(drTiers[j]["DiscountValue"]),
                                Convert.ToInt32(drTiers[j]["StatusId"]),
                                Convert.ToString(drTiers[j]["Status"]));
                            condition.Tiers.Add(tier);
                        }
                        conditions.Add(condition);
                    }

                    List <PromotionLocation> locations = new List <PromotionLocation>();
                    for (int i = 0; i < ds.Tables[3].Rows.Count; i++)
                    {
                        PromotionLocation location = new PromotionLocation(
                            Convert.ToInt32(ds.Tables[3].Rows[i]["LocationId"]),
                            Convert.ToInt32(ds.Tables[3].Rows[i]["PromotionId"]),
                            Convert.ToString(ds.Tables[3].Rows[i]["LocationVal"]),
                            Convert.ToString(ds.Tables[3].Rows[i]["LocationCode"]),
                            Convert.ToString(ds.Tables[3].Rows[i]["LocationType"]),
                            Convert.ToInt32(ds.Tables[3].Rows[i]["LineNumber"]),
                            Convert.ToInt32(ds.Tables[3].Rows[i]["StatusId"]),
                            Convert.ToString(ds.Tables[3].Rows[i]["Status"]));
                        locations.Add(location);
                    }
                    promotion = new Promotion(
                        Convert.ToInt32(ds.Tables[0].Rows[0]["PromotionId"]),
                        Convert.ToString(ds.Tables[0].Rows[0]["PromotionName"]),
                        Convert.ToInt32(ds.Tables[0].Rows[0]["PromotionCategoryId"]),
                        Convert.ToString(ds.Tables[0].Rows[0]["PromotionCategory"]),
                        Convert.ToString(ds.Tables[0].Rows[0]["PromotionCode"]),
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["StartDate"]),
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["EndDate"]),                                //check for null
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["DurationStart"]),                          //check for null
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["DurationEnd"]),                            //check for null
                        Convert.ToInt32(ds.Tables[0].Rows[0]["DiscountTypeId"]),                            //check for null
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["DiscountType"], String.Empty),      //check for null
                        Convert.ToDecimal(ds.Tables[0].Rows[0]["DiscountValue"]),                           //check for null
                        Convert.ToDecimal(ds.Tables[0].Rows[0]["MaxOrderQty"]),
                        Convert.ToInt32(ds.Tables[0].Rows[0]["StatusId"]),
                        Convert.ToString(ds.Tables[0].Rows[0]["Status"]),
                        Convert.ToInt32(ds.Tables[0].Rows[0]["CreatedBy"]),
                        Convert.ToInt32(ds.Tables[0].Rows[0]["ModifiedBy"]),
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["CreatedDate"]),
                        Convert.ToDateTime(ds.Tables[0].Rows[0]["ModifiedDate"]),                                 //check for null
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["ApplicabilityId"], Common.INT_DBNULL),    //check for null
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["Applicability"], string.Empty),           //check for null
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["BuyConditionTypeId"], Common.INT_DBNULL), //check for null
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["BuyConditionType"], string.Empty),
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["GetConditionTypeId"], Common.INT_DBNULL),
                        Validators.CheckForDBNull(ds.Tables[0].Rows[0]["GetConditionType"], string.Empty),
                        Convert.ToInt32(ds.Tables[0].Rows[0]["RepeatFactor"]),
                        conditions, locations, null,
                        #region Shopping Cart
                        Convert.ToBoolean(ds.Tables[0].Rows[0]["POS"]),
                        Convert.ToBoolean(ds.Tables[0].Rows[0]["Web"]),
                        Convert.ToString(ds.Tables[0].Rows[0]["WebImage"])
                        #endregion

                        );
                }
            }
            return(promotion);
        }
예제 #20
0
        /// <summary>
        /// Search constituent
        /// </summary>
        /// <param name="objCompositeItem"></param>
        /// <param name="xmlDoc"></param>
        /// <param name="spName"></param>
        /// <param name="errorMessage"></param>
        public void Search_CompositeBOM(CompositeItem objCompositeItem, string xmlDoc, string spName, ref string errorMessage)
        {
            List <CompositeBOM> listCompositeBOM = new List <CompositeBOM>();

            try
            {
                DataTaskManager dt = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();

                        if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0) //No dbError
                        {
                            //Exp date
                            if (ds.Tables[2].Rows.Count > 0)
                            {
                                objCompositeItem.ExpDate = Convert.ToDateTime(ds.Tables[2].Rows[0][0]).ToString(Common.DATE_TIME_FORMAT);
                            }
                            foreach (DataRow drConstituent in  ds.Tables[0].Rows)
                            {
                                CompositeBOM objCompositeBOM = new CompositeBOM();
                                objCompositeBOM.ItemId          = Convert.ToInt32(drConstituent["ItemId"]);
                                objCompositeBOM.ItemName        = Convert.ToString(drConstituent["ItemName"]);
                                objCompositeBOM.CompositeItemId = Convert.ToInt32(drConstituent["CompositeItemID"]);
                                objCompositeBOM.ItemCode        = Convert.ToString(drConstituent["ItemCode"]);
                                objCompositeBOM.ShortName       = Convert.ToString(drConstituent["Shortname"]);

                                objCompositeBOM.Quantity     = Convert.ToInt32(drConstituent["Quantity"]);
                                objCompositeBOM.AvailableQty = Convert.ToInt32(drConstituent["AvailableQty"]);



                                if (ds.Tables[2].Rows.Count > 0)
                                {
                                    DataRow[] drBatchDetails = ds.Tables[1].Select("ItemId=" + objCompositeBOM.ItemId);
                                    if (drBatchDetails.Length > 0)
                                    {
                                        List <BatchDetails> listBatchDetails = new List <BatchDetails>();
                                        foreach (DataRow drBatchDetail in drBatchDetails)
                                        {
                                            BatchDetails objBatchDetails = new BatchDetails();
                                            objBatchDetails.ItemId          = Convert.ToInt32(drBatchDetail["ItemId"]);
                                            objBatchDetails.ItemName        = Convert.ToString(drBatchDetail["ItemName"]);
                                            objBatchDetails.CompositeItemId = Convert.ToInt32(drBatchDetail["CompositeItemID"]);
                                            objBatchDetails.ItemCode        = Convert.ToString(drBatchDetail["ItemCode"]);
                                            objBatchDetails.AvailableQty    = Convert.ToInt32(drBatchDetail["AvailableQty"]);
                                            objBatchDetails.BatchNo         = Convert.ToString(drBatchDetail["BatchNo"]);
                                            objBatchDetails.MfgBatchNo      = Convert.ToString(drBatchDetail["ManufactureBatchNo"]);
                                            objBatchDetails.ExpDate         = Convert.ToDateTime(drBatchDetail["ExpDate"]).ToString(PUCommon.DATE_FORMAT_yyy_MM_dd);
                                            objBatchDetails.MfgDate         = Convert.ToDateTime(drBatchDetail["MfgDate"]).ToString(PUCommon.DATE_FORMAT_yyy_MM_dd);
                                            objBatchDetails.MRP             = Convert.ToString(drBatchDetail["MRP"]);

                                            listBatchDetails.Add(objBatchDetails);
                                        }
                                        objCompositeBOM.ListAllBatchDetails = listBatchDetails;
                                    }

                                    listCompositeBOM.Add(objCompositeBOM);
                                }
                            }
                            objCompositeItem.CompositeDetail = listCompositeBOM;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #21
0
        /// <summary>
        /// Search  pack/unpack records from
        /// databse base on search conditions
        ///
        /// </summary>
        /// <param name="xmlDoc"></param>
        /// <param name="spName"></param>
        /// <param name="errorMessage"></param>
        /// <returns></returns>
        public List <PUHeader> Search_Header_Detail(string xmlDoc, string spName, ref string errorMessage)
        {
            List <PUHeader> listPUHeader = new List <PUHeader>();

            try
            {
                DataTaskManager dt = new DataTaskManager();

                using (DataTaskManager dtManager = new DataTaskManager())
                {
                    DBParameterList dbParam = new DBParameterList();

                    dbParam.Add(new DBParameter(Common.PARAM_DATA, xmlDoc, DbType.String));
                    dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                                ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                    using (DataSet ds = dtManager.ExecuteDataSet(spName, dbParam))
                    {
                        errorMessage = dbParam[Common.PARAM_OUTPUT].Value.ToString();
                        //ds.WriteXml("c:\\aaaa.xml");
                        if (errorMessage.Length == 0 && ds != null && ds.Tables.Count > 0)  //No dbError
                        {
                            foreach (DataRow drHeader in ds.Tables[0].Rows)
                            {
                                PUHeader objPUHeader = new PUHeader();
                                objPUHeader.ItemName        = Convert.ToString(drHeader["ItemName"]);
                                objPUHeader.LocationId      = Convert.ToInt32(drHeader["LocationId"]);
                                objPUHeader.ModifiedDate    = Convert.ToDateTime(drHeader["ModifiedDate"]).ToString(Common.DATE_TIME_FORMAT);
                                objPUHeader.PUNo            = Convert.ToString(drHeader["PUNo"]);
                                objPUHeader.CompositeItemId = Convert.ToInt32(drHeader["CompositeItemId"]);
                                objPUHeader.Quantity        = Convert.ToInt32(drHeader["Quantity"]);
                                objPUHeader.Remarks         = Convert.ToString(drHeader["Remarks"]);
                                objPUHeader.IsPackVoucher   = Convert.ToBoolean(drHeader["PU_Flag"]);
                                if (objPUHeader.IsPackVoucher)
                                {
                                    objPUHeader.DisplayIsPackVoucher = PUCommon.DISPLAY_PACK;
                                }
                                else
                                {
                                    objPUHeader.DisplayIsPackVoucher = PUCommon.DISPLAY_UNPACK;
                                }


                                objPUHeader.ItemCode = Convert.ToString(drHeader["ItemCode"]);
                                objPUHeader.PUDate   = Convert.ToDateTime(drHeader["PUDate"]).ToString(PUCommon.DATE_FORMAT_yyy_MM_dd);

                                DataRow[] detailList = ds.Tables[1].Select("PUNo = '" + objPUHeader.PUNo + "'");

                                List <PUDetail> listPUDetail = new List <PUDetail>();
                                if (detailList.Length > 0)
                                {
                                    foreach (DataRow drDetail in detailList)
                                    {
                                        PUDetail objPUDetail = new PUDetail();
                                        objPUDetail.PUNo     = Convert.ToString(drDetail["PUNo"]);
                                        objPUDetail.ItemName = Convert.ToString(drDetail["ItemName"]);
                                        objPUDetail.ItemId   = Convert.ToInt32(drDetail["ItemId"]);
                                        objPUDetail.SeqNo    = Convert.ToInt32(drDetail["SeqNo"]);
                                        objPUDetail.Quantity = Convert.ToInt32(drDetail["Quantity"]);
                                        objPUDetail.ItemCode = Convert.ToString(drDetail["ItemCode"]);
                                        listPUDetail.Add(objPUDetail);
                                    }
                                }

                                objPUHeader.DetailItem = listPUDetail;

                                listPUHeader.Add(objPUHeader);
                            }
                        }
                    }
                }
                return(listPUHeader);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
예제 #22
0
        public static AppUser Search(string userName, string locationCode)
        {
            try
            {
                AppUser         loggedInUser = null;
                string          dbMessage    = string.Empty;
                DBParameterList dbParam      = new DBParameterList();
                dbParam.Add(new DBParameter(Common.PARAM_DATA, userName, DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_DATA2, locationCode, DbType.String));
                dbParam.Add(new DBParameter(Common.PARAM_DATA3, Common.AppType, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String, ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                using (DataTaskManager dt = new DataTaskManager())
                {
                    DataSet ds = dt.ExecuteDataSet(SP_USER_SEARCH, dbParam);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        loggedInUser              = new AppUser();
                        loggedInUser.Address1     = ds.Tables[0].Rows[0]["Address1"].ToString();
                        loggedInUser.Address2     = ds.Tables[0].Rows[0]["Address2"].ToString();
                        loggedInUser.Address3     = ds.Tables[0].Rows[0]["Address3"].ToString();
                        loggedInUser.Address4     = ds.Tables[0].Rows[0]["Address4"].ToString();
                        loggedInUser.City         = ds.Tables[0].Rows[0]["CityName"].ToString();
                        loggedInUser.CityId       = Convert.ToInt32(ds.Tables[0].Rows[0]["CityId"]);
                        loggedInUser.Country      = ds.Tables[0].Rows[0]["CountryName"].ToString();
                        loggedInUser.CountryId    = Convert.ToInt32(ds.Tables[0].Rows[0]["CountryId"]);
                        loggedInUser.CreatedBy    = Convert.ToInt32(ds.Tables[0].Rows[0]["CreatedBy"]);
                        loggedInUser.CreatedDate  = ds.Tables[0].Rows[0]["CreatedDate"].ToString();
                        loggedInUser.Designation  = ds.Tables[0].Rows[0]["Designation"].ToString();
                        loggedInUser.Dob          = ds.Tables[0].Rows[0]["DOB"].ToString();
                        loggedInUser.Email1       = ds.Tables[0].Rows[0]["EmailId1"].ToString();
                        loggedInUser.Email2       = ds.Tables[0].Rows[0]["EmailId2"].ToString();
                        loggedInUser.Fax1         = ds.Tables[0].Rows[0]["Fax1"].ToString();
                        loggedInUser.Fax2         = ds.Tables[0].Rows[0]["Fax2"].ToString();
                        loggedInUser.FirstName    = ds.Tables[0].Rows[0]["FirstName"].ToString();
                        loggedInUser.LastName     = ds.Tables[0].Rows[0]["LastName"].ToString();
                        loggedInUser.MiddleName   = ds.Tables[0].Rows[0]["MiddleName"].ToString();
                        loggedInUser.Mobile1      = ds.Tables[0].Rows[0]["Mobile1"].ToString();
                        loggedInUser.Mobile2      = ds.Tables[0].Rows[0]["Mobile2"].ToString();
                        loggedInUser.ModifiedBy   = Convert.ToInt32(ds.Tables[0].Rows[0]["ModifiedBy"]);
                        loggedInUser.ModifiedDate = ds.Tables[0].Rows[0]["ModifiedDate"].ToString();
                        //loggedInUser.Password = ds.Tables[0].Rows[0]["Password"].ToString();
                        loggedInUser.PhoneNumber1 = ds.Tables[0].Rows[0]["Phone1"].ToString();
                        loggedInUser.PhoneNumber2 = ds.Tables[0].Rows[0]["Phone2"].ToString();
                        loggedInUser.PinCode      = ds.Tables[0].Rows[0]["PinCode"].ToString();
                        loggedInUser.State        = ds.Tables[0].Rows[0]["StateName"].ToString();
                        loggedInUser.StateId      = Convert.ToInt32(ds.Tables[0].Rows[0]["StateId"]);
                        loggedInUser.Status       = Convert.ToInt32(ds.Tables[0].Rows[0]["Status"]);
                        loggedInUser.StatusValue  = ds.Tables[0].Rows[0]["StatusName"].ToString();
                        loggedInUser.Title        = Convert.ToInt32(ds.Tables[0].Rows[0]["Title"]);
                        loggedInUser.TitleName    = ds.Tables[0].Rows[0]["TitleName"].ToString();
                        loggedInUser.UserId       = Convert.ToInt32(ds.Tables[0].Rows[0]["UserId"]);
                        loggedInUser.UserName     = ds.Tables[0].Rows[0]["UserName"].ToString();
                        loggedInUser.Website      = ds.Tables[0].Rows[0]["Website"].ToString();

                        //Create AppUserLocationRole object and assign location details and role details

                        if (ds.Tables[1].Rows.Count > 0 && ds.Tables[2].Rows.Count > 0)
                        {
                            AppUserLocationRoles locationRoles = new AppUserLocationRoles();
                            locationRoles.LocationId   = Convert.ToInt32(ds.Tables[1].Rows[0]["LocationId"]);
                            locationRoles.LocationCode = ds.Tables[1].Rows[0]["LocationCode"].ToString();
                            locationRoles.LocationName = ds.Tables[1].Rows[0]["LocationName"].ToString();
                            foreach (DataRow dr in ds.Tables[2].Rows)
                            {
                                //If the role has not been already added then add role
                                if (locationRoles.Roles.Find(delegate(Role r) { return(r.RoleCode == dr["RoleCode"].ToString()); }) == null)
                                {
                                    //Create and Add Role Object
                                    Role r = new Role();
                                    r.RoleCode = dr["RoleCode"].ToString();
                                    r.RoleId   = Convert.ToInt32(dr["RoleId"]);
                                    r.RoleName = dr["RoleName"].ToString();

                                    DataRow[] moduleList = ds.Tables[2].Select("RoleId = " + r.RoleId + " AND ModuleCode <> '" + string.Empty + "'");
                                    foreach (DataRow drM in moduleList)
                                    {
                                        if (r.AssignedModules.Find(delegate(Module m) { return(m.Code == drM["ModuleCode"].ToString()); }) == null)
                                        {
                                            //Create and add assigned module
                                            Module mod = new Module();
                                            mod.Code     = drM["ModuleCode"].ToString();
                                            mod.ModuleId = Convert.ToInt32(drM["ModuleId"]);
                                            mod.Name     = drM["ModuleName"].ToString();

                                            DataRow[] functionList = ds.Tables[2].Select("RoleId = " + r.RoleId + " AND ModuleId = " + mod.ModuleId + " AND FunctionCode <> '" + string.Empty + "'");
                                            foreach (DataRow drF in functionList)
                                            {
                                                if (mod.Functions.Find(delegate(Function f) { return(f.Code == drF["FunctionCode"].ToString()); }) == null)
                                                {
                                                    //Create and add functions
                                                    Function newFunc = new Function();
                                                    newFunc.Code       = drF["FunctionCode"].ToString();
                                                    newFunc.FunctionId = Convert.ToInt32(drF["FunctionId"]);
                                                    newFunc.Name       = drF["FunctionName"].ToString();

                                                    DataRow[] conditionList = ds.Tables[2].Select("RoleId = " + r.RoleId + " AND ModuleId = " + mod.ModuleId + " AND FunctionId = " + newFunc.FunctionId + " AND ConditionCode <> '" + string.Empty + "'");

                                                    foreach (DataRow drC in conditionList)
                                                    {
                                                        if (newFunc.AssignedConditions.Find(delegate(Condition c) { return(c.Code == drC["ConditionCode"].ToString()); }) == null)
                                                        {
                                                            Condition newCon = new Condition();
                                                            newCon.Code        = drC["ConditionCode"].ToString();
                                                            newCon.ConditionId = Convert.ToInt32(drC["ConditionId"]);
                                                            newCon.Name        = drC["ConditionName"].ToString();
                                                            newFunc.AssignedConditions.Add(newCon);
                                                        }
                                                    }
                                                    mod.Functions.Add(newFunc);
                                                }
                                            }
                                            r.AssignedModules.Add(mod);
                                        }
                                    }
                                    locationRoles.Roles.Add(r);
                                }
                            }
                            loggedInUser.LocationRoles.Add(locationRoles);
                        }
                    }
                }
                return(loggedInUser);
            }
            catch
            {
                throw;
            }
        }
        /// <summary>
        /// Get items to be consolidated
        /// </summary>
        /// <param name="IsItemUnderConsolidationExists"></param>
        /// <returns></returns>
        //public static List<Item> GetUnderConsolidationItems(int intConsolidationId, ref Boolean IsItemUnderConsolidationExists)
        public static List <Item> GetUnderConsolidationItems(int intConsolidationId, ref Boolean IsItemUnderConsolidationExists, ref List <Item> lstApprovedIndentItems)
        {
            IsItemUnderConsolidationExists = true;
            List <Item>     lstItemsForConsolidation = new List <Item>();
            DBParameterList dbParam;

            try
            {
                Vinculum.Framework.Data.DataTaskManager dtManager = new DataTaskManager();

                //Declare and initialize the parameter list object.
                dbParam = new DBParameterList();

                //Add the relevant 2 parameters
                dbParam.Add(new DBParameter("@ConsolidationId", intConsolidationId, DbType.Int32));
                dbParam.Add(new DBParameter(Common.PARAM_OUTPUT, string.Empty, DbType.String,
                                            ParameterDirection.Output, Common.PARAM_OUTPUT_LENGTH));

                // executing procedure to save the record
                DataSet ds = dtManager.ExecuteDataSet(SP_ITEMS_UNDER_CONSOLIDATION_SEARCH, dbParam);

                //Populate the List Item from the grid
                if (ds != null && ds.Tables.Count > 0)
                {
                    if (ds.Tables[0].Rows.Count > 0)
                    {
                        for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                        {
                            Item tmpItem = new Item();
                            tmpItem.ItemId      = Convert.ToInt32(ds.Tables[0].Rows[i]["ITEMID"]);
                            tmpItem.ItemCode    = ds.Tables[0].Rows[i]["ITEMCODE"].ToString();
                            tmpItem.ItemName    = ds.Tables[0].Rows[i]["ITEMNAME"].ToString();
                            tmpItem.Selected    = false;
                            tmpItem.IsComposite = Convert.ToBoolean(ds.Tables[0].Rows[i]["ISCOMPOSITE"]);
                            lstItemsForConsolidation.Add(tmpItem);
                            IsItemUnderConsolidationExists = true;
                        }
                    }
                    else
                    {
                        IsItemUnderConsolidationExists = false;
                    }

                    if (ds.Tables[1] != null)
                    {
                        foreach (DataRow drRow in ds.Tables[1].Rows)
                        {
                            Item tmpApprovedItem = new Item();
                            tmpApprovedItem.ItemId      = Convert.ToInt32(drRow["ITEMID"]);
                            tmpApprovedItem.ItemCode    = drRow["ITEMCODE"].ToString();
                            tmpApprovedItem.ItemName    = drRow["ITEMNAME"].ToString();
                            tmpApprovedItem.Selected    = false;
                            tmpApprovedItem.IsComposite = Convert.ToBoolean(drRow["ISCOMPOSITE"]);
                            lstApprovedIndentItems.Add(tmpApprovedItem);
                        }
                    }
                }
                return(lstItemsForConsolidation);
                //}
                //else
                //{

                //    if (ds.Tables.Count >0 && ds.Tables[1]!=null)
                //    {
                //        for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                //        {
                //            Item tmpItem = new Item();
                //            tmpItem.ItemId = Convert.ToInt32(ds.Tables[1].Rows[i]["ITEMID"]);
                //            tmpItem.ItemCode = ds.Tables[1].Rows[i]["ITEMCODE"].ToString();
                //            tmpItem.ItemName = ds.Tables[1].Rows[i]["ITEMNAME"].ToString();
                //            tmpItem.Selected = false;
                //            tmpItem.IsComposite = Convert.ToBoolean(ds.Tables[1].Rows[i]["ISCOMPOSITE"]);
                //            lstItemsForConsolidation.Add(tmpItem);
                //        }
                //    }
                //}
                //return lstItemsForConsolidation;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }