Example #1
0
        private List <PackageFactorMaster> BindFactorByPackage(DataTable datatable)
        {
            var objPackageFactorList = new List <PackageFactorMaster>();

            try
            {
                if (datatable != null && datatable.Rows.Count > 0)
                {
                    var objPackageFactor    = new PackageFactorMaster();
                    var objPackage          = new PackageMaster();
                    var objFactorMasterList = new List <PackageFactor>();
                    var objPackageFactorID  = new List <int>();
                    objPackage.PackageId        = (datatable.Rows[0]["AjPackageId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[0]["AjPackageId"]);
                    objPackage.PackageName      = (datatable.Rows[0]["PackageName"] is DBNull) ? "" : Convert.ToString(datatable.Rows[0]["PackageName"]);
                    objPackage.PackageAmount    = (datatable.Rows[0]["PackageAmount"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[0]["PackageAmount"]);
                    objPackage.IsChargeable     = (datatable.Rows[0]["IsPackageChargeable"] is DBNull) ? false : Convert.ToBoolean(datatable.Rows[0]["IsPackageChargeable"]);
                    objPackage.IsVisible        = (datatable.Rows[0]["IsVisible"] is DBNull) ? false : Convert.ToBoolean(datatable.Rows[0]["IsVisible"]);
                    objPackage.courseId         = (datatable.Rows[0]["AjCourseId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[0]["AjCourseId"]);
                    objPackage.CourseName       = (datatable.Rows[0]["AjCourseName"] is DBNull) ? null : Convert.ToString(datatable.Rows[0]["AjCourseName"]);
                    objPackageFactor.objPackage = objPackage;
                    for (var j = 0; j < datatable.Rows.Count; j++)
                    {
                        var packageFactorId  = (datatable.Rows[j]["AjPackageFactorId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[j]["AjPackageFactorId"]);
                        var objPackageMaster = new PackageFactor();
                        objPackageMaster.FactorID   = (datatable.Rows[j]["FactorId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[j]["FactorId"]);
                        objPackageMaster.FactorName = (datatable.Rows[j]["AjFactorName"] is DBNull) ? "" : Convert.ToString(datatable.Rows[j]["AjFactorName"]);
                        objPackageFactorID.Add(packageFactorId);
                        objFactorMasterList.Add(objPackageMaster);
                    }
                    objPackageFactor.ObjPackageFactor = objFactorMasterList;
                    objPackageFactor.PackageFactorId  = objPackageFactorID;
                    objPackageFactorList.Add(objPackageFactor);
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
                if (ex.InnerException != null)
                {
                    err = err + " :: Inner Exception :- " + ex.ToString();
                }
                const string addInfo = "Error while executing BindFactorByPackage in FormFackageFactor.cs  :: -> ";
                var          objPub  = new ClsExceptionPublisher();
                objPub.Publish(err, addInfo);
            }
            return(objPackageFactorList);
        }
Example #2
0
        private List <PackageFactor> BindPackageFactor(DataTable datatable)
        {
            var objPackageFactorList = new List <PackageFactor>();

            if (datatable != null && datatable.Rows.Count > 0)
            {
                for (var j = 0; j < datatable.Rows.Count; j++)
                {
                    var objPackageFactor = new PackageFactor
                    {
                        FactorID     = (datatable.Rows[j]["AjFactorId"] is DBNull) ? 0 : Convert.ToInt32(datatable.Rows[j]["AjFactorId"]),
                        FactorName   = (datatable.Rows[j]["AjFactorName"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjFactorName"]),
                        FactorRemark = (datatable.Rows[j]["AjFactorRemark"] is DBNull) ? null : Convert.ToString(datatable.Rows[j]["AjFactorRemark"]),
                        IsChargeable = (datatable.Rows[j]["AjIsChargeable"] is DBNull) ? false : Convert.ToBoolean(datatable.Rows[j]["AjIsChargeable"]),
                        IsVisible    = (datatable.Rows[j]["AjIsVisible"] is DBNull) ? false : Convert.ToBoolean(datatable.Rows[j]["AjIsVisible"])
                    };
                    objPackageFactorList.Add(objPackageFactor);
                }
            }

            return(objPackageFactorList);
        }