Example #1
0
 public DateSelect()
 {
     InitializeComponent();
     DateTime d = new CommonFunctions().GetServerTime();
     monthCalendar1.SelectionStart = d.AddMonths(-1);
     monthCalendar2.SelectionStart = d;
 }
 public RequestFromModel SaveRequest(RequestFromModel RFM, string mode)
 {
     objDal = new DalFunctions();
     objCon = new MyRealtyWeb.Data.Common.ClsConnection();
     objCom = new CommonFunctions();
     SqlParameter[] sqlParams = {
                   new SqlParameter("@Id",SqlDbType.Int){Value = 1},
       new SqlParameter("@FName",SqlDbType.NVarChar){Value = RFM.FName},
       new SqlParameter("@LName",SqlDbType.NVarChar){Value = RFM.LName},
       new SqlParameter("@EmailAddress",SqlDbType.NVarChar){Value = RFM.EmailAddress},
       new SqlParameter("@IsActive",SqlDbType.Bit){Value = false},
       new SqlParameter("@IsDelete",SqlDbType.Bit){Value = false},
       new SqlParameter("@UpdDt",SqlDbType.DateTime){Value = DateTime.Now},
       new SqlParameter("@UpdBy",SqlDbType.NVarChar){Value = ""},
       new SqlParameter("@Mode",SqlDbType.NVarChar){Value = mode},
        };
     CommandType type = CommandType.StoredProcedure;
     SqlConnection con = objCon.myCon();
     objState = new ClsConState.clsConnectionState(con);
     RequestFromModel objModel = new RequestFromModel();
     DataTable dt = new DataTable();
     using (con)
     {
         dt = objDal.ExecuteReader(con, "Website_InsertRequest", type, sqlParams);
     }
     if (dt.Rows.Count > 0)
     {
         objModel.FName = Convert.ToString(objCom.HandleNull(dt.Rows[0]["FName"]));
         objModel.LName = Convert.ToString(objCom.HandleNull(dt.Rows[0]["LName"]));
         objModel.EmailAddress = Convert.ToString(objCom.HandleNull(dt.Rows[0]["EmailAddress"]));
     }
     return objModel;
 }
 public void BindLoanType()
 {
     clsComFun = new CommonFunctions();
     try
     {
         clsComFun.LoanTypes(ddlLoanType);
     }
     catch { }
     finally { clsComFun = null; }
 }
 public void BindNomini()
 {
     clsComFun = new CommonFunctions();
     try
     {
         clsComFun.LoanNominee(ddlNomini);
     }
     catch { }
     finally { clsComFun = null; }
 }
 private void LoadCombo()
 {
     try
     {
         LoadComboRef(ref ddlDivision, ALRD_DivisionInfoService.GetService().GetAll(new ALRD_DivisionInfoEntity()).ToList(), CommonFunctions.GetPropertyName((ALRD_DivisionInfoEntity x) => x.DESCRIPT), CommonFunctions.GetPropertyName((ALRD_DivisionInfoEntity x) => x.COMPID));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Example #6
0
        public override System.Xml.XmlDocument XmlSerialize()
        {
            System.Xml.XmlDocument document = base.XmlSerialize();

            System.Xml.XmlNode propertiesNode = document.ChildNodes[1].ChildNodes[0];



            #region Properties

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "MetricType", ((Int32)metricType).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "MetricTypeName", metricType.ToString());


            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "DataType", ((Int32)dataType).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "DataTypeName", dataType.ToString());


            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "MinimumValue", minimumValue.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "MaximumValue", maximumValue.ToString());


            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostDataSource", ((Int32)costDataSource).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostClaimDateType", ((Int32)costClaimDateType).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostDataSourceName", costDataSource.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostReportingPeriod", ((Int32)costReportingPeriod).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostReportingPeriodName", costReportingPeriod.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostReportingPeriodValue", costReportingPeriodValue.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostReportingPeriodQualifier", ((Int32)costReportingPeriodQualifier).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostReportingPeriodQualifierName", costReportingPeriodQualifier.ToString());


            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostWatermarkPeriod", ((Int32)costWatermarkPeriod).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostWatermarkPeriodName", costWatermarkPeriod.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostWatermarkPeriodValue", costWatermarkPeriodValue.ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostWatermarkPeriodQualifier", ((Int32)costWatermarkPeriodQualifier).ToString());

            CommonFunctions.XmlDocumentAppendPropertyNode(document, propertiesNode, "CostWatermarkPeriodQualifierName", costWatermarkPeriodQualifier.ToString());

            #endregion


            // TODO: COST SERVICES EXPORT

            #region Cost Services

            //System.Xml.XmlElement CostServicesNode = CommonFunctions.XmlDocumentAppendPropertyNode (document, propertiesNode, "CostServices", String.Empty);

            //foreach (WorkQueueTeam currentWorkQueueTeam in workTeams) {

            //    System.Xml.XmlElement workQueueTeamNode;


            //    workQueueTeamNode = document.CreateElement ("WorkQueueTeam");

            //    workQueueTeamNode.SetAttribute ("WorkTeamId", currentWorkQueueTeam.WorkTeamId.ToString ());

            //    workQueueTeamNode.SetAttribute ("WorkTeamName", application.CoreObjectGetNameById ("WorkTeam", currentWorkQueueTeam.WorkTeamId));

            //    workQueueTeamNode.SetAttribute ("Permission", ((Int32)currentWorkQueueTeam.Permission).ToString ());

            //    workQueueTeamNode.SetAttribute ("PermissionName", currentWorkQueueTeam.Permission.ToString ());


            //    workQueueTeamsNode.AppendChild (workQueueTeamNode);

            //}

            #endregion


            return(document);
        }
Example #7
0
 public response GetChildrens(string tableName)
 {
     return(CommonFunctions.GetChildrens(this, tableName));
 }
        /**
         *  Create Trial Asset
         *	@param ctx context
         *	@param user user
         *	@param entityType entity type
         *	@return asset or null if no product found
         */
        public static MAsset GetTrial(Ctx ctx, MUser user, String entityType)
        {
            if (user == null)
            {
                _log.Warning("Cannot create Trial - No User");
                return(null);
            }
            if (Utility.Util.IsEmpty(entityType))
            {
                _log.Warning("Cannot create Trial - No Entity Type");
                return(null);
            }
            MProduct product = MProduct.GetTrial(ctx, entityType);

            if (product == null)
            {
                _log.Warning("No Trial for Entity Type=" + entityType);
                return(null);
            }
            //
            DateTime now = Convert.ToDateTime(CommonFunctions.CurrentTimeMillis());
            //
            MAsset asset = new MAsset(ctx, 0, null);

            asset.SetClientOrg(user);
            asset.SetAssetServiceDate(now);
            asset.SetIsOwned(false);
            asset.SetIsTrialPhase(true);
            //
            MBPartner partner    = new MBPartner(ctx, user.GetC_BPartner_ID(), null);
            String    documentNo = "Trial";
            //	Value
            String value = partner.GetValue() + "_" + product.GetValue();

            if (value.Length > 40 - documentNo.Length)
            {
                value = value.Substring(0, 40 - documentNo.Length) + documentNo;
            }
            asset.SetValue(value);
            //	Name		MProduct.afterSave
            String name = "Trial " + partner.GetName() + " - " + product.GetName();

            if (name.Length > 60)
            {
                name = name.Substring(0, 60);
            }
            asset.SetName(name);
            //	Description
            String description = product.GetDescription();

            asset.SetDescription(description);

            //	User
            asset.SetAD_User_ID(user.GetAD_User_ID());
            asset.SetC_BPartner_ID(user.GetC_BPartner_ID());
            //	Product
            asset.SetM_Product_ID(product.GetM_Product_ID());
            asset.SetA_Asset_Group_ID(product.GetA_Asset_Group_ID());
            asset.SetQty(new Decimal(product.GetSupportUnits()));
            //	Guarantee & Version
            asset.SetGuaranteeDate(TimeUtil.AddDays(now, product.GetTrialPhaseDays()));
            asset.SetVersionNo(product.GetVersionNo());
            //
            return(asset);
        }
Example #9
0
        public response Insert()
        {
            response toReturn = Validare();

            if (!toReturn.Status)
            {
                return(toReturn);
            }
            PropertyInfo[] props       = this.GetType().GetProperties();
            ArrayList      _parameters = new ArrayList();

            var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "plati");

            foreach (PropertyInfo prop in props)
            {
                if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                {
                    string propName  = prop.Name;
                    string propType  = prop.PropertyType.ToString();
                    object propValue = prop.GetValue(this, null);
                    propValue = propValue ?? DBNull.Value;
                    if (propType != null)
                    {
                        if (propName.ToUpper() != "ID") // il vom folosi doar la Edit!
                        {
                            _parameters.Add(new MySqlParameter(String.Format("_{0}", propName.ToUpper()), propValue));
                        }
                    }
                }
            }
            DataAccess da = new DataAccess(authenticatedUserId, connectionString, CommandType.StoredProcedure, "PLATIsp_insert", _parameters.ToArray());

            toReturn = da.ExecuteInsertQuery();
            if (toReturn.Status)
            {
                this.ID = toReturn.InsertedId;

                if (toReturn.Status)
                {
                    try
                    {
                        Dosar d = new Dosar(authenticatedUserId, connectionString, Convert.ToInt32(this.ID_DOSAR));
                        d.UpdateCounterPlati(1);
                    }
                    catch (Exception exp) { LogWriter.Log(exp); }
                }

                if (toReturn.Status)
                {
                    try
                    {
                        Dosar d = new Dosar(this.authenticatedUserId, this.connectionString, Convert.ToInt32(this.ID_DOSAR));
                        d.REZERVA_DAUNA -= this.SUMA;
                        d.GetNewStatus(false);
                        response r = d.Update();
                        if (!r.Status)
                        {
                            toReturn = r;
                        }
                    }
                    catch (Exception exp)
                    {
                        toReturn = new response(false, exp.ToString(), null, null, new List <Error>()
                        {
                            new Error(exp)
                        });
                        LogWriter.Log(exp);
                    }
                }
            }
            return(toReturn);
        }
Example #10
0
 public response ValidareColoane(string fieldValueCollection)
 {
     return(CommonFunctions.ValidareColoane(this, fieldValueCollection));
 }
Example #11
0
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        //CommonFunctions.Connection = new System.Data.SqlClient.SqlConnection();
        this.RegionsSet            = new Vacations.RegionsDataset();
        this.StateProvincesSet     = new Vacations.StateProvincesDataset();
        this.AmenitiesSet          = new Vacations.AmenitiesDataset();
        this.CountriesAdapter      = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlSelectCommand4     = new System.Data.SqlClient.SqlCommand();
        this.AmenitiesAdapter      = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlInsertCommand5     = new System.Data.SqlClient.SqlCommand();
        this.sqlSelectCommand3     = new System.Data.SqlClient.SqlCommand();
        this.RegionsAdapter        = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlInsertCommand6     = new System.Data.SqlClient.SqlCommand();
        this.sqlSelectCommand5     = new System.Data.SqlClient.SqlCommand();
        this.AttractionsAdapter    = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlInsertCommand4     = new System.Data.SqlClient.SqlCommand();
        this.sqlSelectCommand1     = new System.Data.SqlClient.SqlCommand();
        this.CitiesSet             = new Vacations.CitiesDataset();
        this.CountriesSet          = new Vacations.CountriesDataset();
        this.StateProvincesAdapter = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlInsertCommand3     = new System.Data.SqlClient.SqlCommand();
        this.sqlSelectCommand2     = new System.Data.SqlClient.SqlCommand();
        this.AttractionsSet        = new Vacations.AttractionsDataset();
        this.CitiesAdapter         = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlInsertCommand1     = new System.Data.SqlClient.SqlCommand();
        this.sqlSelectCommand7     = new System.Data.SqlClient.SqlCommand();
        this.PropertiesFullSet     = new Vacations.PropertiesFullDataset();
        this.PropertiesAdapter     = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlSelectCommand6     = new System.Data.SqlClient.SqlCommand();
        this.CountriesSet2         = new Vacations.CountriesDataset();
        ((System.ComponentModel.ISupportInitialize)(this.RegionsSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.StateProvincesSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.AmenitiesSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.CitiesSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.CountriesSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.AttractionsSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.PropertiesFullSet)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.CountriesSet2)).BeginInit();
        //
        // CommonFunctions.Connection
        //
        //CommonFunctions.Connection.ConnectionString = "workstation id=MAIN;packet size=4096;integrated security=SSPI;data source=MAIN;pe" +
        //"rsist security info=False;initial catalog=Vacations";
        //
        // RegionsSet
        //
        this.RegionsSet.DataSetName = "RegionsDataset";
        this.RegionsSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // StateProvincesSet
        //
        this.StateProvincesSet.DataSetName = "StateProvincesDataset";
        this.StateProvincesSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // AmenitiesSet
        //
        this.AmenitiesSet.DataSetName = "AmenitiesDataset";
        this.AmenitiesSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // CountriesAdapter
        //
        this.CountriesAdapter.SelectCommand = this.sqlSelectCommand4;
        this.CountriesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Countries", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("RegionID", "RegionID"),
                new System.Data.Common.DataColumnMapping("Country", "Country")
            })
        });
        //
        // sqlSelectCommand4
        //
        this.sqlSelectCommand4.CommandText = "CountryDistinctList";
        this.sqlSelectCommand4.CommandType = CommandType.StoredProcedure;
        this.sqlSelectCommand4.Connection  = CommonFunctions.GetConnection();
        //
        // AmenitiesAdapter
        //
        this.AmenitiesAdapter.InsertCommand = this.sqlInsertCommand5;
        this.AmenitiesAdapter.SelectCommand = this.sqlSelectCommand3;
        this.AmenitiesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Amenities", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("Amenity", "Amenity")
            })
        });
        //
        // sqlInsertCommand5
        //
        this.sqlInsertCommand5.CommandText = "INSERT INTO Amenities(ID, Amenity) VALUES (@ID, @Amenity)";
        this.sqlInsertCommand5.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand5.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ID", System.Data.SqlDbType.Int, 4, "ID"));
        this.sqlInsertCommand5.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Amenity", System.Data.SqlDbType.NVarChar, 300, "Amenity"));
        //
        // sqlSelectCommand3
        //
        this.sqlSelectCommand3.CommandText = "AmenityDistinctList";
        this.sqlSelectCommand3.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand3.CommandType = CommandType.StoredProcedure;
        //
        // RegionsAdapter
        //
        this.RegionsAdapter.InsertCommand = this.sqlInsertCommand6;
        this.RegionsAdapter.SelectCommand = this.sqlSelectCommand5;
        this.RegionsAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Regions", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("Region", "Region")
            })
        });
        //
        // sqlInsertCommand6
        //
        this.sqlInsertCommand6.CommandText = "INSERT INTO Regions(Region) VALUES (@Region)";
        this.sqlInsertCommand6.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand6.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Region", System.Data.SqlDbType.NVarChar, 300, "Region"));
        //
        // sqlSelectCommand5
        //
        this.sqlSelectCommand5.CommandText = "RegionDistinctList";
        this.sqlSelectCommand5.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand5.CommandType = CommandType.StoredProcedure;
        //
        // AttractionsAdapter
        //
        this.AttractionsAdapter.InsertCommand = this.sqlInsertCommand4;
        this.AttractionsAdapter.SelectCommand = this.sqlSelectCommand1;
        this.AttractionsAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Attractions", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("Attraction", "Attraction")
            })
        });
        //
        // sqlInsertCommand4
        //
        this.sqlInsertCommand4.CommandText = "INSERT INTO Attractions(ID, Attraction) VALUES (@ID, @Attraction)";
        this.sqlInsertCommand4.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@ID", System.Data.SqlDbType.Int, 4, "ID"));
        this.sqlInsertCommand4.Parameters.Add(new System.Data.SqlClient.SqlParameter("@Attraction", System.Data.SqlDbType.NVarChar, 300, "Attraction"));
        //
        // sqlSelectCommand1
        //
        this.sqlSelectCommand1.CommandText = "AttractionsDistinctList";
        this.sqlSelectCommand1.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand1.CommandType = CommandType.StoredProcedure;
        //
        // CitiesSet
        //
        this.CitiesSet.DataSetName = "CitiesDataset";
        this.CitiesSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // CountriesSet
        //
        this.CountriesSet.DataSetName = "CountriesDataset";
        this.CountriesSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // StateProvincesAdapter
        //
        this.StateProvincesAdapter.InsertCommand = this.sqlInsertCommand3;
        this.StateProvincesAdapter.SelectCommand = this.sqlSelectCommand2;
        this.StateProvincesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "StateProvinces", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("CountryID", "CountryID"),
                new System.Data.Common.DataColumnMapping("StateProvince", "StateProvince")
            })
        });
        //
        // sqlInsertCommand3
        //
        this.sqlInsertCommand3.CommandText = "INSERT INTO StateProvinces(CountryID, StateProvince) VALUES (@CountryID, @StateProvince)";
        this.sqlInsertCommand3.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@CountryID", System.Data.SqlDbType.Int, 4, "CountryID"));
        this.sqlInsertCommand3.Parameters.Add(new System.Data.SqlClient.SqlParameter("@StateProvince", System.Data.SqlDbType.NVarChar, 300, "StateProvince"));
        //
        // sqlSelectCommand2
        //
        this.sqlSelectCommand2.CommandText = "StateProvinceDistinctList";
        this.sqlSelectCommand2.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand2.CommandType = CommandType.StoredProcedure;
        //
        // AttractionsSet
        //
        this.AttractionsSet.DataSetName = "AttractionsDataset";
        this.AttractionsSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // CitiesAdapter
        //
        this.CitiesAdapter.InsertCommand = this.sqlInsertCommand1;
        this.CitiesAdapter.SelectCommand = this.sqlSelectCommand7;
        this.CitiesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Cities", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("StateProvinceID", "StateProvinceID"),
                new System.Data.Common.DataColumnMapping("City", "City")
            })
        });
        //
        // sqlInsertCommand1
        //
        this.sqlInsertCommand1.CommandText = "INSERT INTO Cities(StateProvinceID, City) VALUES (@StateProvinceID, @City)";
        this.sqlInsertCommand1.Connection  = CommonFunctions.GetConnection();
        this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@StateProvinceID", System.Data.SqlDbType.Int, 4, "StateProvinceID"));
        this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@City", System.Data.SqlDbType.NVarChar, 300, "City"));
        //
        // sqlSelectCommand7
        //
        this.sqlSelectCommand7.CommandText = @"SELECT DISTINCT Cities.ID, Cities.StateProvinceID, Cities.City FROM Cities INNER JOIN Properties ON Cities.ID=Properties.CityID WHERE (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) UNION SELECT -1, -1, ' Include All' ORDER BY City";
        this.sqlSelectCommand7.Connection  = CommonFunctions.GetConnection();
        //
        // PropertiesFullSet
        //
        this.PropertiesFullSet.DataSetName = "PropertiesFullDataset";
        this.PropertiesFullSet.Locale      = new System.Globalization.CultureInfo("en-US");
        //
        // PropertiesAdapter
        //
        this.PropertiesAdapter.SelectCommand = this.sqlSelectCommand6;
        this.PropertiesAdapter.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Properties", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("MinimumNightlyRental", "MinimumNightlyRental"),
                new System.Data.Common.DataColumnMapping("TaxIncluded", "TaxIncluded")
            })
        });
        //
        // sqlSelectCommand6
        //
        this.sqlSelectCommand6.CommandText = "TopThreePropertiesList";
        this.sqlSelectCommand6.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand6.CommandType = CommandType.StoredProcedure;
        //
        // CountriesSet2
        //
        this.CountriesSet2.DataSetName = "CountriesDataset";
        this.CountriesSet2.Locale      = new System.Globalization.CultureInfo("en-US");
        this.CountriesStates           = new Vacations.CountriesStates();
        this.GetStateProvinces         = new System.Data.SqlClient.SqlDataAdapter();
        this.GetCountries      = new System.Data.SqlClient.SqlDataAdapter();
        this.sqlSelectCommand2 = new System.Data.SqlClient.SqlCommand();
        this.CountriesStates   = new Vacations.CountriesStates();
        this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
        ((System.ComponentModel.ISupportInitialize)(this.CountriesStates)).BeginInit();
        //
        // CommonFunctions.Connection
        //
        //CommonFunctions.Connection.ConnectionString = "workstation id=MAIN;packet size=4096;integrated security=SSPI;data source=MAIN;pe" +
        //"rsist security info=False;initial catalog=Vacations";
        //
        // GetStateProvinces
        //
        this.GetStateProvinces.SelectCommand = this.sqlSelectCommand1;
        this.GetStateProvinces.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "StateProvinces", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("CountryID", "CountryID"),
                new System.Data.Common.DataColumnMapping("StateProvince", "StateProvince"),
                new System.Data.Common.DataColumnMapping("Country", "Country")
            })
        });
        //
        // GetCountries
        //
        this.GetCountries.SelectCommand = this.sqlSelectCommand2;
        this.GetCountries.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
            new System.Data.Common.DataTableMapping("Table", "Countries", new System.Data.Common.DataColumnMapping[] {
                new System.Data.Common.DataColumnMapping("ID", "ID"),
                new System.Data.Common.DataColumnMapping("RegionID", "RegionID"),
                new System.Data.Common.DataColumnMapping("Country", "Country")
            })
        });
        //
        // sqlSelectCommand2
        //
        //this.sqlSelectCommand2.CommandText = @"SELECT ID, RegionID, Country FROM Countries WHERE (RegionID = @RegionID) AND EXISTS (SELECT * FROM (Properties INNER JOIN Cities ON Properties.CityID = Cities.ID) INNER JOIN StateProvinces ON Cities.StateProvinceID = StateProvinces.ID WHERE (StateProvinces.CountryID = Countries.ID) AND (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) AND NOT EXISTS (SELECT * FROM Auctions WHERE PropertyID = Properties.ID)) ORDER BY Country";
        this.sqlSelectCommand2.CommandText = @"SELECT ID, RegionID, Country FROM Countries WHERE (RegionID = @RegionID) AND EXISTS (SELECT * FROM (Properties INNER JOIN Cities ON Properties.CityID = Cities.ID) INNER JOIN StateProvinces ON Cities.StateProvinceID = StateProvinces.ID WHERE (StateProvinces.CountryID = Countries.ID) AND (Properties.IfFinished = 1) AND (Properties.IfApproved = 1) ) ORDER BY Country";
        this.sqlSelectCommand2.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand2.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RegionID", System.Data.SqlDbType.Int, 4, "RegionID"));
        this.sqlSelectCommand1.CommandText = @"SELECT StateProvinces.ID, StateProvinces.CountryID, StateProvinces.StateProvince, Countries.Country FROM StateProvinces INNER JOIN Countries ON StateProvinces.CountryID = Countries.ID WHERE (Countries.RegionID = @RegionID) AND EXISTS (SELECT * FROM Properties INNER JOIN Cities ON Properties.CityID = Cities.ID WHERE (Cities.StateProvinceID = StateProvinces.ID) AND (Properties.IfFinished = 1) AND (Properties.IfApproved = 1)) ORDER BY StateProvinces.StateProvince";
        this.sqlSelectCommand1.Connection  = CommonFunctions.GetConnection();
        this.sqlSelectCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@RegionID", System.Data.SqlDbType.Int, 4, "RegionID"));
        //


        // CountriesStates
        //
        this.CountriesStates.DataSetName = "CountriesStates";
        this.CountriesStates.Locale      = new System.Globalization.CultureInfo("en-US");

        //GetStateProvinces = new System.Data.SqlClient.SqlDataAdapter();
        //System.Data.SqlClient.SqlDataAdapter GetCountries= new System.Data.SqlClient.SqlDataAdapter();

        this.GetCountries.SelectCommand.Parameters["@RegionID"].Value      = 6;
        this.GetStateProvinces.SelectCommand.Parameters["@RegionID"].Value = 6;

        ////lock (CommonFunctions.Connection)
        this.GetCountries.Fill(this.CountriesStates);
        ////lock (CommonFunctions.Connection)
        this.GetStateProvinces.Fill(this.CountriesStates);

        this.CountriesStates.Relations.Add("CountriesStates", this.CountriesStates.Tables["Countries"].Columns["ID"],
                                           this.CountriesStates.Tables["StateProvinces"].Columns["CountryID"]);
        //ltlAsia.Text = ds.Tables[0].Rows[1]["RegionTextValue"].ToString();
        //ltlEurope.Text = ds.Tables[0].Rows[2]["RegionTextValue"].ToString();
        //ltlNorthAmerica.Text = ds.Tables[0].Rows[3]["RegionTextValue"].ToString();
        //ltlSouthAmerica.Text = ds.Tables[0].Rows[4]["RegionTextValue"].ToString();
        //ltlOceania.Text = ds.Tables[0].Rows[5]["RegionTextValue"].ToString();
        //ltlAsiaList.Text = GenerateCountryLinks("2");
        //ltlOceaniaList.Text = GenerateCountryLinks("3");
        //ltlSouthAmericaList.Text = GenerateCountryLinks("9");
        //ltlEuropeList.Text = GenerateCountryLinks("6");
        //ltlNorthAmericaList.Text = GenerateCountryLinks("8");

        ((System.ComponentModel.ISupportInitialize)(this.RegionsSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.StateProvincesSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.AmenitiesSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.CitiesSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.CountriesSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.AttractionsSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.PropertiesFullSet)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.CountriesSet2)).EndInit();
    }
Example #12
0
        /// <summary>
        /// Date Modified:  16/03/2012
        /// Modified By:    Charlene Remotigue
        /// (description)   Use Global Code for parsing and casting
        /// -------------------------------------------
        /// Date Modified:  15/08/2012
        /// Modified By:    Josphine Gad
        /// (description)   Add different role's page
        ///----------------------------------------------
        /// Date Modified:  16/08/2012
        /// Modified By:    Jefferson Bermundo
        /// (description)   Add HotelVendor page
        ///                 Set UserBranchId upon Login
        ///----------------------------------------------
        /// Date Modified:  23/10/2012
        /// Modified By:    Josephine Gad
        /// (description)   Change UserAccountBLL.GetUserPrimaryRole(sUser) to list
        ///----------------------------------------------
        /// Date Modified:  27/Nov/2012
        /// Modified By:    Josephine Gad
        /// (description)   Add   List<UserPrimaryDetails> instead of calling different proc in DB
        ///----------------------------------------------
        /// Date Modified:  25/Apr/2013
        /// Modified By:    Josephine Gad
        /// (description)   Change Hotel Vendor's Page to HotelConfirmManifest.aspx Page
        ///----------------------------------------------
        /// Date Modified:  7/May/2013
        /// Modified By:    Marco Abejar
        /// (description)   Change Crew Assist Page to HotelDashboardRoomType5.aspx Page
        ///----------------------------------------------
        /// Date Modified:  11/Aug/2014
        /// Modified By:    Josephine Gad
        /// (description)   Add default page of Crew Medical Role
        /// ===================================
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Page_Load(object sender, EventArgs e)
        {
            //try
            //{
            AlertMessage("Logged already");
            AlertMessage(GlobalCode.Field2String(User.Identity.Name));



            //UserVendorBLL bll = new UserVendorBLL();
            if (GlobalCode.Field2Int(UserVendorBLL.GetActiveUserVendor(User.Identity.Name)) == 0)
            {
                Session["ActiveUserVendor"] = 1;
                Response.Redirect("Login.aspx");

                //AlertMessage("There is no active contract connected in your account.");
            }

            if (User.Identity.Name == "")
            {
                Response.Redirect("Login.aspx", false);
            }
            MembershipUser mUser = Membership.GetUser(User.Identity.Name);

            mUser.UnlockUser();
            //if (mUser.CreationDate.Equals(mUser.LastPasswordChangedDate))
            //{
            //    Response.Redirect("~/LoginReset.aspx", false);
            //}
            //else
            {
                string strLogDescription;
                string strFunction;

                string[] uRoles = Roles.GetRolesForUser(mUser.UserName);

                if (uRoles[0] != "")
                {
                    string sUser = mUser.UserName;
                    List <UserAccountList> userAccount = UserAccountBLL.GetUserInfoListByName(sUser);
                    Session["UserAccountList"] = userAccount;

                    List <UserPrimaryDetails> userDetails = (List <UserPrimaryDetails>)Session["UserPrimaryDetails"];

                    var vRole = (from a in userAccount
                                 where a.bIsPrimary == true
                                 select new
                    {
                        sRole = a.sRole
                    }).ToList();                      //UserAccountBLL.GetUserPrimaryRole(sUser);
                    string PrimaryRole  = vRole[0].sRole;
                    string strUserFName = userDetails[0].sFirstName + " as " + PrimaryRole;
                    //UserAccountBLL.GetUserFirstname(mUser.ToString()) + " as " + PrimaryRole;

                    DateTime dDateFrom = CommonFunctions.GetCurrentDateTime();
                    Session["UserName"] = sUser;
                    Session["UserRole"] = PrimaryRole;
                    Session["DateFrom"] = dDateFrom.ToString("MM/dd/yyyy");

                    //add UserBranchId Upon LogIn
                    Session["UserBranchID"] = userDetails[0].iBranchID;   //UserAccountBLL.GetUserBranchId(sUser, PrimaryRole);
                    Session["BranchName"]   = userDetails[0].sBranchName; //UserAccountBLL.GetUserBranchName(sUser, PrimaryRole);
                    Session["VendorID"]     = userDetails[0].iVendorID;   // UserAccountBLL.GetUserVendorId(sUser, PrimaryRole);

                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     sUser, dDateFrom, dDateFrom.AddMinutes(90), false, PrimaryRole, FormsAuthentication.FormsCookiePath);

                    //Insert log audit trail (Gabriel Oquialda - 16/02/2012)
                    strLogDescription = "User logged as " + PrimaryRole + ".";
                    strFunction       = "Page_Load";

                    DateTime dateNow = CommonFunctions.GetCurrentDateTime();

                    BLL.AuditTrailBLL.InsertLogAuditTrail(0, "", strLogDescription, strFunction, Path.GetFileName(Request.Path),
                                                          CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, sUser);

                    if (PrimaryRole == TravelMartVariable.RoleAdministrator)
                    {
                        Response.Redirect("~/HotelDashboardRoomType5.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleHotelSpecialist)
                    {
                        //Response.Redirect("~/HotelDashboardRoomType.aspx?ufn=" + strUserFName);
                        Response.Redirect("~/HotelDashboardRoomType5.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RolePortSpecialist)
                    {
                        Response.Redirect("~/PortAgent/PortAgentDashboardNew.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleMeetGreet)
                    {
                        Response.Redirect("~/MeetAndGreet/MeetAndGreet.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleCrewAdmin)
                    {
                        Response.Redirect("~/CrewAdmin/CrewAdmin.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleHotelVendor)
                    {
                        //Response.Redirect("~/Hotel/HotelVendor.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                        Response.Redirect("~/Hotel/HotelConfirmManifest.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleSystemAnalyst)
                    {
                        Response.Redirect("~/SystemAnalyst/ExceptionPNR.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleFinance)
                    {
                        Response.Redirect("~/ManifestSearchFilterPage.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleImmigration)
                    {
                        Response.Redirect("~/Immigration/CrewVerification.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleCrewAssist)
                    {
                        Response.Redirect("~/CrewAssist/CrewAssist.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                        //Response.Redirect("~/CrewAssist/CrewAssistNew.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleCrewAssistTeamLead)
                    {
                        Response.Redirect("~/CrewAssist/CrewAssist.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                        //Response.Redirect("~/Medical/Medical.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleVehicleVendor)
                    {
                        Response.Redirect("~/Vehicle/VehicleManifestByVendor.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleCrewMedical)
                    {
                        Response.Redirect("~/ManifestSearchFilterPage.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }

                    else if (PrimaryRole == TravelMartVariable.RoleCrewMedical)
                    {
                        Response.Redirect("~/ManifestSearchFilterPage.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleDriver)
                    {
                        Response.Redirect("~/Vehicle/VehicleManifestByVendor.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    else if (PrimaryRole == TravelMartVariable.RoleGreeter)
                    {
                        Response.Redirect("~/Vehicle/VehicleManifestByVendor.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy"));
                    }
                    //else
                    //{
                    //    Response.Redirect("~/Manifest.aspx?ufn=" + strUserFName + "&dt=" + DateTime.Now.ToString("MM/dd/yyyy")); //gelo
                    //}
                }
                else
                {
                    Response.Redirect("~/Login.aspx", false);
                }
            }
            //}
            //catch (Exception ex)
            //{
            //    ExceptionBLL.InsertException(ex.Message, "LoginProcess.aspx", CommonFunctions.GetCurrentDateTime(), Session["UserName"].ToString());
            //}
        }
        private void GenerateReport()
        {
            _student.FullName    = _student.GetFullName();
            _student.FullAddress = _student.GetFullAddress();
            List <Student> list = new List <Student>();

            list.Add(_student);
            DataTable dt1 = CommonFunctions.ToDataTable <Student>(list);

            DataTable dt2 = new DataTable();

            dt2.Columns.Add("col1");
            dt2.Columns.Add("col2");

            foreach (DataColumn col in dt1.Columns)
            {
                DataRow dr1 = dt2.NewRow();
                dr1["col1"] = col.ColumnName;
                dr1["col2"] = dt1.Rows[0][col.ColumnName].ToString();
                dt2.Rows.Add(dr1);
            }

            // _student.FullName = _student.GetFullName();
            // _student.FullAddress = _student.GetFullAddress();
            // DataTable dt = new DataTable();
            // dt.Columns.Add("col1");
            // dt.Columns.Add("col2");
            // dt.Columns.Add("col3");
            // dt.Columns.Add("col4");
            //// dt.Columns.Add("col5");

            // DataRow dr = dt.NewRow();
            // dr["col2"] = "Student Report";
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Student Full Name:";
            // dr["col2"] = _student.FullName;
            // dr["col3"] = "Gender:";
            // dr["col4"] = _student.Gender;
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Date of Birth:";
            // dr["col2"] = _student.DateOfBirth?.ToString("dd/MM/yyyy");
            // dr["col3"] = "Ethnicity:";
            // dr["col4"] = _student.Ethnicity;
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Admitted to Activity Centre:";
            // dr["col2"] = _student.AdmittedToActivityCentre?.ToString("dd/MM/yyyy");
            // dr["col3"] = "Place of Birth:";
            // dr["col4"] = _student.PlaceOfBirth;
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Admitted to Residence:";
            // dr["col2"] = _student.AdmittedToResidence?.ToString("dd/MM/yyyy");
            // dr["col3"] = "NHI Number:";
            // dr["col4"] = _student.NHINumber;
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Home Phonee:";
            // dr["col2"] = _student.HomePhone;
            // dr["col3"] = "Mobile Phone:";
            // dr["col4"] = _student.MobilePhone;
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Full Address:";
            // dr["col2"] = _student.FullAddress;

            // dr = dt.NewRow();
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Doctor(s)";
            // dt.Rows.Add(dr);

            // foreach (Doctor doctor in _student.Doctors)
            // {
            //     dr = dt.NewRow();
            //     dr["col1"] = doctor.FullName;
            //     dr["col2"] = doctor.GetFullAddress();
            //     dr["col3"] = doctor.Phone;
            //     dt.Rows.Add(dr);
            // }

            // dr = dt.NewRow();
            // dt.Rows.Add(dr);

            // dr = dt.NewRow();
            // dr["col1"] = "Next of Kin(s)";
            // dt.Rows.Add(dr);

            // foreach (NextOfKin nextofkin in _student.NextOfKin)
            // {
            //     dr = dt.NewRow();
            //     dr["col1"] = nextofkin.FullName;
            //     dr["col2"] = nextofkin.GetFullAddress();
            //     dr["col3"] = nextofkin.Phone;
            //     dr["col4"] = nextofkin.Relationship;
            //     dt.Rows.Add(dr);
            // }


            DataFile df = new DataFile();

            df.IOFileInfo.FileFullPath     = _jarvis.OutputFileLocation + _student.FullName + "_Student Report_" + _jarvis.FileIncrement + ".XLSX";
            df.IOFileInfo.OutputDataSource = dt2;
            df.IOFileInfo.CreateHeader     = false;
            df.IOFileInfo.WorkSheetName    = _student.FullName;

            DataAccessBase eda = new ExcelDataAccess(df.IOFileInfo);

            //eda.ReportProgress += new EventHandler<DataAccessEventMessenger>(eda_ReportProgress);
            eda.Save();
            System.Diagnostics.Process.Start(df.IOFileInfo.FileFullPath);
        }
Example #14
0
        public void WritePropertyXML()
        {
            string fileLocation = HttpContext.Current.Server.MapPath("Output") + "\\";

            try
            {
                ClearXMLDirectory(fileLocation);
                ArrayList skipList = new ArrayList();
                GetPrimaryKeyFields(WrapperAppParams.TableName, ref skipList);
                GetColumnType(WrapperAppParams.TableName, ref skipList);
                string   query         = "select * from " + WrapperAppParams.TableName + " where ";
                string[] pkFieldList   = WrapperAppParams.FieldNames.Split(';');
                string[] pkFieldValues = WrapperAppParams.FieldValues.Split(';');
                for (int k = 0; k < pkFieldList.Length; k++)
                {
                    query += " \"" + pkFieldList[k] + "\"='" + pkFieldValues[k] + "'";
                    if (k < pkFieldList.Length - 1)
                    {
                        query += " AND ";
                    }
                }

                NpgsqlConnection dbConnection = new NpgsqlConnection();
                dbConnection.ConnectionString = CommonFunctions.GetWrapperConenctionString();
                dbConnection.Open();
                DataTable   dtValues = GetDataTable(query, dbConnection);
                XmlDocument xml      = new XmlDocument();
                XmlElement  root     = xml.CreateElement("CAD");
                xml.AppendChild(root);
                XmlComment comment = xml.CreateComment("config values");
                root.AppendChild(comment);

                XmlElement connectionString = xml.CreateElement("connectionString");
                connectionString.InnerText = CommonFunctions.GetConnectionString();
                root.AppendChild(connectionString);

                XmlElement wrapperConnectionString = xml.CreateElement("wrapperConnectionString");
                wrapperConnectionString.InnerText = CommonFunctions.GetWrapperConenctionString();
                root.AppendChild(wrapperConnectionString);

                XmlElement metaTable = xml.CreateElement("metaTable");
                metaTable.InnerText = CommonFunctions.GetMetaTableName();
                root.AppendChild(metaTable);

                //XmlElement metaTableStorage = xml.CreateElement("metadataStorage");
                //metaTableStorage.InnerText = CommonFunctions.GetMetaDataStorageName();
                //root.AppendChild(metaTableStorage);

                XmlElement activeDatabase = xml.CreateElement("activeDatabase");
                activeDatabase.InnerText = CommonFunctions.GetActiveDatabaseName();
                root.AppendChild(activeDatabase);

                comment = xml.CreateComment("field-value pair below");
                root.AppendChild(comment);
                XmlElement group = xml.CreateElement("group");
                group.InnerText = WrapperAppParams.GroupName;
                root.AppendChild(group);

                DataRow dtRow = dtValues.Rows[0];
                foreach (DataColumn col in dtValues.Columns)
                {
                    XmlElement field = xml.CreateElement("field");
                    XmlElement name  = xml.CreateElement("name");
                    if (!skipList.Contains(col.ColumnName))
                    {
                        name.InnerText = col.ColumnName;
                        XmlElement value = xml.CreateElement("value");
                        if (col.DataType.Name == "DateTime")
                        {
                            string date = "";
                            try
                            {
                                date = Convert.ToDateTime(dtRow[col.ColumnName]).ToString("dd-MM-yyyy");
                            }
                            catch
                            {
                            }
                            finally
                            {
                                value.InnerText = date;
                            }
                        }
                        else
                        {
                            value.InnerText = dtRow[col.ColumnName].ToString();
                        }

                        field.AppendChild(name);
                        field.AppendChild(value);
                        root.AppendChild(field);
                    }
                }



                System.IO.StreamWriter sw = new System.IO.StreamWriter(fileLocation + WrapperAppParams.FileName, false);

                sw.WriteLine(xml.InnerXml);
                sw.Close();

                dbConnection.Close();
                dtValues.Dispose();
            }
            catch (Exception exp)
            {
                File.Delete(fileLocation + WrapperAppParams.FileName);
                throw exp;
            }
        }
Example #15
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="context"></param>
        public override void UpdateUIControlContext(object context)
        {
            try
            {
                base.UpdateUIControlContext(context);

                Parameter parameter = (Parameter)context;

                switch (parameter.Name)
                {
                case RegisterUpdateUIMsg.DisabledReadCardButton:
                    this.btnReadCard.Enabled = false;
                    break;

                case RegisterUpdateUIMsg.EnabledReadCardButton:
                    this.btnReadCard.Enabled = true;
                    break;

                case RegisterUpdateUIMsg.EnabledRegisterButton:
                    this.btnReadCard.Enabled = true;
                    break;

                case RegisterUpdateUIMsg.DisabledRegisterButton:
                    this.btnReadCard.Enabled = false;
                    break;

                case RegisterUpdateUIMsg.DisabledPrintButton:
                    this.btnPrint.Enabled = false;
                    break;

                case RegisterUpdateUIMsg.EnabledPrintButton:
                    this.btnPrint.Enabled = true;
                    break;

                case RegisterUpdateUIMsg.DisabledClearButton:
                    this.btnClear.Enabled = false;
                    break;

                case RegisterUpdateUIMsg.EnabledClearButton:
                    this.btnClear.Enabled = true;
                    break;

                case RegisterUpdateUIMsg.SetPersonInfo:
                    SetPersonInfo(parameter.Object);
                    break;

                case RegisterUpdateUIMsg.ReadCardSuccess:
                    this._statusEvent.Status = "101";
                    break;

                case RegisterUpdateUIMsg.ReadCardFailure:
                    this._statusEvent.Status = "102";
                    break;

                case RegisterUpdateUIMsg.SaveSuccess:
                    this._statusEvent.Status = "201";
                    this._statusEvent.Status = "300";
                    CreateAndStartThread(this._thread, ThreadSaveDiagnoseInfo);
                    break;

                case RegisterUpdateUIMsg.SaveDiagnoseInfoSuccess:
                    this._statusEvent.Status = "301";
                    break;

                case RegisterUpdateUIMsg.SaveDiagnoseInfoFailure:
                    this._statusEvent.Status = "302";
                    break;

                case RegisterUpdateUIMsg.SaveFailure:
                    this._statusEvent.Status = "202";
                    break;

                default:
                    break;
                }
            }
            catch (Exception ex)
            {
                CommonFunctions.MsgError(ex.Message);
            }
        }
Example #16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnRegister_Click(object sender, EventArgs e)
        {
            if (this.txtBox_serial_no.Text.Trim() == string.Empty)
            {
                CommonFunctions.MsgInfo("就医保存号不能为空!!!");

                return;
            }

            try
            {
                this._inParameter = new InterfaceClass.HN.ZY.RegisterUpdate.InParameter();

                if (!CheckAndSetValue())
                {
                    return;
                }

                List <List <Parameter> > listListParameter = new List <List <Parameter> >();

                listListParameter.Add(GetProperties <InterfaceClass.HN.ZY.RegisterUpdate.InParameter>(this._inParameter));

                GetTextBoxText(this.groupBoxRegisterInfo, ref listListParameter);

                foreach (List <Parameter> listParameter in listListParameter)
                {
                    foreach (Parameter p in listParameter)
                    {
                        List <Parameter> listInParameterArributes = GetProperties <InterfaceClass.HN.ZY.RegisterUpdate.InParameter>(this._inParameter);

                        foreach (Parameter pInParameterAttribute in listInParameterArributes)
                        {
                            if (p.Name == pInParameterAttribute.Name)
                            {
                                this._inParameter.SetAttributeValue(p.Name, p.Value);
                            }
                        }
                    }
                }

                List <InterfaceClass.HN.ZY.SaveDiagnoseInfo.DiagnoseInfo> listDiagnose = new List <InterfaceClass.HN.ZY.SaveDiagnoseInfo.DiagnoseInfo>();

                if (this.c1FlexGridDisease.Cols.Contains("诊断编号"))
                {
                    for (int i = 1; i < this.c1FlexGridDisease.Rows.Count; i++)
                    {
                        string icd           = this.c1FlexGridDisease.Rows[i]["诊断编号"].ToString().Trim();
                        string diagnose_code = this.cBox_diagnose_code.SelectedValue.ToString().Trim();


                        InterfaceClass.HN.ZY.SaveDiagnoseInfo.DiagnoseInfo diagnoseInfo = new InterfaceClass.HN.ZY.SaveDiagnoseInfo.DiagnoseInfo();

                        diagnoseInfo.SetAttributeValue("diagnose_sn", i.ToString());
                        diagnoseInfo.SetAttributeValue("diagnose_code", diagnose_code);
                        diagnoseInfo.SetAttributeValue("icd", icd);

                        listDiagnose.Add(diagnoseInfo);
                    }
                }

                this._listDiagnose = listDiagnose;
            }
            catch (Exception ex)
            {
                CommonFunctions.MsgError("入院保存生成参数失败,请联系管理员!!!");
                return;
            }
            this._statusEvent.Status = "200";

            this._inParameter.serial_no = this.txtBox_serial_no.Text.Trim();

            CreateAndStartThread(this._thread, ThreadSave);
        }
        public response DeleteOrphanFile(string fileName)
        {
            bool toReturn = FileManager.DeleteOrphan(Path.Combine(CommonFunctions.GetScansFolder(), fileName));

            return(new response(toReturn, "", toReturn, null, null));
        }
Example #18
0
        /// <summary>
        ///     Create a LifestyleQuality from an XmlNode.
        /// </summary>
        /// <param name="objXmlLifestyleQuality">XmlNode to create the object from.</param>
        /// <param name="objCharacter">Character object the LifestyleQuality will be added to.</param>
        /// <param name="objParentLifestyle">Lifestyle object to which the LifestyleQuality will be added.</param>
        /// <param name="objLifestyleQualitySource">Source of the LifestyleQuality.</param>
        /// <param name="strExtra">Forced value for the LifestyleQuality's Extra string (also used by its bonus node).</param>
        public void Create(XmlNode objXmlLifestyleQuality, Lifestyle objParentLifestyle, Character objCharacter,
                           QualitySource objLifestyleQualitySource, string strExtra = "")
        {
            ParentLifestyle = objParentLifestyle;
            if (!objXmlLifestyleQuality.TryGetField("id", Guid.TryParse, out _guiSourceID))
            {
                Log.Warn(new object[] { "Missing id field for xmlnode", objXmlLifestyleQuality });
                Utils.BreakIfDebug();
            }
            else
            {
                _objCachedMyXmlNode = null;
            }

            if (objXmlLifestyleQuality.TryGetStringFieldQuickly("name", ref _strName))
            {
                _objCachedMyXmlNode = null;
            }
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("lp", ref _intLP);
            objXmlLifestyleQuality.TryGetStringFieldQuickly("cost", ref _strCost);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("multiplier", ref _intMultiplier);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("multiplierbaseonly", ref _intBaseMultiplier);
            if (objXmlLifestyleQuality.TryGetStringFieldQuickly("category", ref _strCategory))
            {
                Type = ConvertToLifestyleQualityType(_strCategory);
            }
            OriginSource = objLifestyleQualitySource;
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("areamaximum", ref _intAreaMaximum);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("comfortsmaximum", ref _intComfortMaximum);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("securitymaximum", ref _intSecurityMaximum);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("area", ref _intArea);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("comforts", ref _intComfort);
            objXmlLifestyleQuality.TryGetInt32FieldQuickly("security", ref _intSecurity);
            objXmlLifestyleQuality.TryGetBoolFieldQuickly("print", ref _blnPrint);
            objXmlLifestyleQuality.TryGetBoolFieldQuickly("contributetolimit", ref _blnContributeToLP);
            if (!objXmlLifestyleQuality.TryGetStringFieldQuickly("altnotes", ref _strNotes))
            {
                objXmlLifestyleQuality.TryGetStringFieldQuickly("notes", ref _strNotes);
            }
            objXmlLifestyleQuality.TryGetStringFieldQuickly("source", ref _strSource);
            objXmlLifestyleQuality.TryGetStringFieldQuickly("page", ref _strPage);
            var strAllowedFreeLifestyles = string.Empty;

            if (objXmlLifestyleQuality.TryGetStringFieldQuickly("allowed", ref strAllowedFreeLifestyles))
            {
                _lstAllowedFreeLifestyles = strAllowedFreeLifestyles.Split(',', StringSplitOptions.RemoveEmptyEntries);
            }
            _strExtra = strExtra;
            if (!string.IsNullOrEmpty(_strExtra))
            {
                var intParenthesesIndex = _strExtra.IndexOf('(');
                if (intParenthesesIndex != -1)
                {
                    _strExtra = intParenthesesIndex + 1 < strExtra.Length
                        ? strExtra.Substring(intParenthesesIndex + 1).TrimEndOnce(')')
                        : string.Empty;
                }
            }


            if (string.IsNullOrEmpty(Notes))
            {
                string strEnglishNameOnPage = Name;
                string strNameOnPage        = string.Empty;
                // make sure we have something and not just an empty tag
                if (objXmlLifestyleQuality.TryGetStringFieldQuickly("nameonpage", ref strNameOnPage) &&
                    !string.IsNullOrEmpty(strNameOnPage))
                {
                    strEnglishNameOnPage = strNameOnPage;
                }

                string strGearNotes = CommonFunctions.GetTextFromPdf(Source + ' ' + Page, strEnglishNameOnPage);

                if (string.IsNullOrEmpty(strGearNotes) && GlobalOptions.Language != GlobalOptions.DefaultLanguage)
                {
                    string strTranslatedNameOnPage = CurrentDisplayName;

                    // don't check again it is not translated
                    if (strTranslatedNameOnPage != _strName)
                    {
                        // if we found <altnameonpage>, and is not empty and not the same as english we must use that instead
                        if (objXmlLifestyleQuality.TryGetStringFieldQuickly("altnameonpage", ref strNameOnPage) &&
                            !string.IsNullOrEmpty(strNameOnPage) && strNameOnPage != strEnglishNameOnPage)
                        {
                            strTranslatedNameOnPage = strNameOnPage;
                        }

                        Notes = CommonFunctions.GetTextFromPdf(Source + ' ' + DisplayPage(GlobalOptions.Language),
                                                               strTranslatedNameOnPage);
                    }
                }
                else
                {
                    Notes = strGearNotes;
                }
            }
            // If the item grants a bonus, pass the information to the Improvement Manager.
            XmlNode xmlBonus = objXmlLifestyleQuality["bonus"];

            if (xmlBonus != null)
            {
                var strOldForced = ImprovementManager.ForcedValue;
                if (!string.IsNullOrEmpty(_strExtra))
                {
                    ImprovementManager.ForcedValue = _strExtra;
                }
                if (!ImprovementManager.CreateImprovements(objCharacter, Improvement.ImprovementSource.Quality,
                                                           InternalId, xmlBonus, 1, DisplayNameShort(GlobalOptions.Language)))
                {
                    _guiID = Guid.Empty;
                    ImprovementManager.ForcedValue = strOldForced;
                    return;
                }

                if (!string.IsNullOrEmpty(ImprovementManager.SelectedValue))
                {
                    _strExtra = ImprovementManager.SelectedValue;
                }
                ImprovementManager.ForcedValue = strOldForced;
            }

            // Built-In Qualities appear as grey text to show that they cannot be removed.
            if (objLifestyleQualitySource == QualitySource.BuiltIn)
            {
                Free = true;
            }
        }
        /// <summary>
        /// Date Created:   04/Feb/2015
        /// Created By:     Josephine Monteza
        /// (description)   Save the "ToBeAdded" column for Vendor's approval
        /// -------------------------------------------------------
        /// </summary>
        private void SaveHotelForecast()
        {
            DataTable dt = null;

            try
            {
                HotelForecastBLL BLL      = new HotelForecastBLL();
                DateTime         dateNow  = CommonFunctions.GetCurrentDateTime();
                DateTime         dateOnly = GlobalCode.Field2DateTime(dateNow.ToString("MM/dd/yyyy"));

                Label listLabelDate;

                //HiddenField listHiddenFieldToAddDBL;
                //HiddenField listHiddenFieldToAddSGL;

                TextBox listTextBoxDBL;
                TextBox listTextBoxSGL;
                TextBox listTextBoxRemarks;
                TextBox listTextBoxRoomToDropDBL;
                TextBox listTextBoxRoomToDropSGL;

                CheckBox listCheckBoxSelect;

                int iCount   = uolistviewHotelInfo.Items.Count;
                int iHotelID = GlobalCode.Field2Int(uoDropDownListHotel.SelectedValue);

                DataColumn colBranchIDInt    = new DataColumn("colBranchIDInt", typeof(Int64));
                DataColumn colDate           = new DataColumn("colDate", typeof(DateTime));
                DataColumn colForecastDBLAdj = new DataColumn("colForecastDBLAdj", typeof(int));
                DataColumn colForecastSGLAdj = new DataColumn("colForecastSGLAdj", typeof(int));
                DataColumn colRemarksVarchar = new DataColumn("colRemarksVarchar", typeof(string));
                DataColumn colRoomToDropDBL  = new DataColumn("colRoomToDropDBL", typeof(int));
                DataColumn colRoomToDropSGL  = new DataColumn("colRoomToDropSGL", typeof(int));

                dt = new DataTable();
                dt.Columns.Add(colBranchIDInt);
                dt.Columns.Add(colDate);
                dt.Columns.Add(colForecastDBLAdj);
                dt.Columns.Add(colForecastSGLAdj);
                dt.Columns.Add(colRemarksVarchar);
                dt.Columns.Add(colRoomToDropDBL);
                dt.Columns.Add(colRoomToDropSGL);

                DataRow  r;
                DateTime rowDate;

                for (int i = 0; i < iCount; i++)
                {
                    listLabelDate = (Label)uolistviewHotelInfo.Items[i].FindControl("uoLabelDate");
                    rowDate       = GlobalCode.Field2DateTime(listLabelDate.Text);

                    if (rowDate >= dateOnly)
                    {
                        listCheckBoxSelect = (CheckBox)uolistviewHotelInfo.Items[i].FindControl("uoCheckBoxSelect");
                        if (listCheckBoxSelect.Checked)
                        {
                            //listHiddenFieldToAddDBL = (HiddenField)uolistviewHotelInfo.Items[i].FindControl("uoHiddenFieldToAddDBL");
                            //listHiddenFieldToAddSGL = (HiddenField)uolistviewHotelInfo.Items[i].FindControl("uoHiddenFieldToAddSGL");

                            listTextBoxDBL     = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxDBLAdj");
                            listTextBoxSGL     = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxSGLAdj");
                            listTextBoxRemarks = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRemarks");

                            listTextBoxRoomToDropDBL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRoomToDropDBL");
                            listTextBoxRoomToDropSGL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRoomToDropSGL");


                            int iToAddDBLAdj = GlobalCode.Field2Int(listTextBoxDBL.Text);
                            int iToAddSGLAdj = GlobalCode.Field2Int(listTextBoxSGL.Text);

                            int iRoomToDropDBL = GlobalCode.Field2Int(listTextBoxRoomToDropDBL.Text);
                            int iRoomToDropSGL = GlobalCode.Field2Int(listTextBoxRoomToDropSGL.Text);

                            r = dt.NewRow();
                            r["colBranchIDInt"]    = iHotelID;
                            r["colDate"]           = rowDate;
                            r["colForecastDBLAdj"] = iToAddDBLAdj;
                            r["colForecastSGLAdj"] = iToAddSGLAdj;
                            r["colRemarksVarchar"] = listTextBoxRemarks.Text;

                            r["colRoomToDropDBL"] = iRoomToDropDBL;
                            r["colRoomToDropSGL"] = iRoomToDropSGL;
                            dt.Rows.Add(r);
                        }
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    BLL.UpdateForecastManifest(GlobalCode.Field2Int(uoDropDownListHotel.SelectedValue),
                                               uoHiddenFieldUser.Value, "Adjust Forecast", "SaveHotelForecast",
                                               Path.GetFileName(Request.Path),
                                               CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, dt);

                    GetSFHotelTravelDetails();
                    AlertMessage("Record successfully saved!");
                }
                else
                {
                    AlertMessage("No record changed!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
Example #20
0
        internal static void FormLoad(ref MenuEvent oMenuEvent, SAPbobsCOM.Company sbo_company, ref Application sbo_application, out bool bBubbleEvent, string sessionId)
        {
            bBubbleEvent = true;

            FormCreationParams FormCreationPackage;
            Form oForm = null;

            if (oMenuEvent.BeforeAction)
            {
                FormCreationPackage = (FormCreationParams)sbo_application.CreateObject(BoCreatableObjectType.cot_FormCreationParams);

                try
                {
                    if (string.IsNullOrEmpty(sessionId))
                    {
                        sessionId = sbo_application.Company.GetServiceLayerConnectionContext(ServiceLayer.Address);
                    }

                    string      contenidoArchivo = Properties.Resources.ResourceManager.GetString(pluginForm.FormType);
                    XmlDocument xmlFormulario    = new XmlDocument();
                    xmlFormulario.LoadXml(contenidoArchivo);

                    FormCreationPackage.XmlData = xmlFormulario.InnerXml;

                    FormCreationPackage.UniqueID = pluginForm.FormType + CommonFunctions.Random().ToString();
                    oForm = sbo_application.Forms.AddEx(FormCreationPackage);

                    FormCreationPackage.UniqueID = "AsignaLote" + CommonFunctions.Random().ToString();
                    oForm = sbo_application.Forms.AddEx(FormCreationPackage);

                    DBDataSource dbData = oForm.DataSources.DBDataSources.Add("OBTN");

                    Matrix oMatrix = (Matrix)oForm.Items.Item(pluginForm.MatrixLote.Uid).Specific;
                    oMatrix.Item.Enabled = false;

                    Column oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_ItemCode.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_ItemCode.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_itemName.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_itemName.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_SysNumber.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_SysNumber.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_DistNumber.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_DistNumber.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_MnfSerial.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_MnfSerial.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_InDate.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_InDate.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_Status.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_Status.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_Quantity.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_Quantity.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_Balance.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_Balance.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_U_FRU_Variedad.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_U_FRU_Variedad.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_U_FRU_Tipo.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_U_FRU_Tipo.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_U_FRU_Calibre.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_U_FRU_Calibre.dbField);
                    oCol.Editable = false;

                    oCol = oMatrix.Columns.Item(pluginForm.MatrixLote.Colums.Col_U_FRU_Destino.Uid);
                    oCol.DataBind.SetBound(true, "OBTN", pluginForm.MatrixLote.Colums.Col_U_FRU_Destino.dbField);

                    SAPbobsCOM.Recordset oRS = (SAPbobsCOM.Recordset)sbo_company.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset);
                    string sSql = " SELECT T0.\"U_DFO_Valor\",T0.\"U_DFO_Descrip\"   FROM \"@DFO_OPDFO\"  T0 " +
                                  "where T0.\"U_DFO_Tipo\" = 'DESTINOSUGERIDO' ";

                    oRS.DoQuery(sSql);
                    if (oRS.RecordCount != 0)
                    {
                        while (!oRS.EoF)
                        {
                            string code = oRS.Fields.Item("U_DFO_Valor").Value.ToString();
                            string name = oRS.Fields.Item("U_DFO_Descrip").Value.ToString();
                            oCol.ValidValues.Add(code, name);
                            oRS.MoveNext();
                        }
                    }
                    oCol.DisplayDesc = true;
                    oCol.Editable    = true;

                    //oConditions = (SAPbouiCOM.Conditions)oApplication.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_Conditions);
                    //oCondition = oConditions.Add();
                    //oCondition.Alias = "your field that you need filtering";
                    //oCondition.Operation = SAPbouiCOM.BoConditionOperation.co_LESS_THAN; //Your condition
                    //oCondition.CondVal = "condition value";

                    ////run your query in your table with your conditions
                    //oDBDS.Query(oConditions);

                    dbData.Query(null);

                    oMatrix.LoadFromDataSourceEx(true);

                    oForm.Visible = true;
                }
                catch
                {
                    throw;
                }
            }
        }
        /// <summary>
        /// Date Created:   07/Oct/2015
        /// Created By:     Josephine Monteza
        /// (description)   Save the Additional Room to Hotel Room Blocks by RCCL
        /// -------------------------------------------------------
        /// </summary>
        private void ApproveHotelForecast()
        {
            DataTable dt = null;

            try
            {
                HotelForecastBLL BLL      = new HotelForecastBLL();
                DateTime         dateNow  = CommonFunctions.GetCurrentDateTime();
                DateTime         dateOnly = GlobalCode.Field2DateTime(dateNow.ToString("MM/dd/yyyy"));

                Label listLabelDate;

                //HiddenField listHiddenFieldToAddDBL;
                //HiddenField listHiddenFieldToAddSGL;

                //TextBox listTextBoxDBL;
                //TextBox listTextBoxSGL;

                TextBox listTextBoxRoomToDropDBL;
                TextBox listTextBoxRoomToDropSGL;

                //TextBox listTextBoxRatePerDayMoneyDBL;
                //TextBox listTextBoxRatePerDayMoneySGL;
                //TextBox listTextBoxRoomRateTaxPercentage;
                //CheckBox listCheckBoxTaxInclusive;

                Label listLabelRoomApprovedSGL;
                Label listLabelRoomApprovedDBL;

                CheckBox    listCheckBoxApprove;
                HiddenField listHiddenFieldAction;

                int iCount   = uolistviewHotelInfo.Items.Count;
                int iHotelID = GlobalCode.Field2Int(uoDropDownListHotel.SelectedValue);

                DataColumn colBranchIDInt = new DataColumn("colBranchIDInt", typeof(Int64));
                DataColumn colDate        = new DataColumn("colDate", typeof(DateTime));
                DataColumn colToAddDBL    = new DataColumn("colToAddDBL", typeof(int));
                DataColumn colToAddSGL    = new DataColumn("colToAddSGL", typeof(int));
                DataColumn colAction      = new DataColumn("colAction", typeof(string));

                DataColumn colRoomToDropDBL = new DataColumn("colRoomToDropDBL", typeof(int));
                DataColumn colRoomToDropSGL = new DataColumn("colRoomToDropSGL", typeof(int));

                DataColumn colRatePerDayMoneySGL     = new DataColumn("colRatePerDayMoneySGL", typeof(float));
                DataColumn colRatePerDayMoneyDBL     = new DataColumn("colRatePerDayMoneyDBL", typeof(float));
                DataColumn colCurrencyIDInt          = new DataColumn("colCurrencyIDInt", typeof(int));
                DataColumn colRoomRateTaxPercentage  = new DataColumn("colRoomRateTaxPercentage", typeof(float));
                DataColumn colRoomRateIsTaxInclusive = new DataColumn("colRoomRateIsTaxInclusive", typeof(float));

                dt = new DataTable();
                dt.Columns.Add(colBranchIDInt);
                dt.Columns.Add(colDate);
                dt.Columns.Add(colToAddDBL);
                dt.Columns.Add(colToAddSGL);
                dt.Columns.Add(colAction);

                dt.Columns.Add(colRoomToDropDBL);
                dt.Columns.Add(colRoomToDropSGL);

                dt.Columns.Add(colRatePerDayMoneySGL);
                dt.Columns.Add(colRatePerDayMoneyDBL);
                dt.Columns.Add(colCurrencyIDInt);
                dt.Columns.Add(colRoomRateTaxPercentage);
                dt.Columns.Add(colRoomRateIsTaxInclusive);

                DataRow  r;
                DateTime rowDate;

                //CheckBox lvuoCheckBoxSelect;

                for (int i = 0; i < iCount; i++)
                {
                    listCheckBoxApprove = (CheckBox)uolistviewHotelInfo.Items[i].FindControl("uoCheckBoxApprove");
                    if (listCheckBoxApprove.Checked)
                    {
                        listHiddenFieldAction = (HiddenField)uolistviewHotelInfo.Items[i].FindControl("uoHiddenFieldAction");
                        listLabelDate         = (Label)uolistviewHotelInfo.Items[i].FindControl("uoLabelDate");
                        rowDate = GlobalCode.Field2DateTime(listLabelDate.Text);

                        if (rowDate >= dateOnly)
                        {
                            //listHiddenFieldToAddDBL = (HiddenField)uolistviewHotelInfo.Items[i].FindControl("uoHiddenFieldToAddDBL");
                            //listHiddenFieldToAddSGL = (HiddenField)uolistviewHotelInfo.Items[i].FindControl("uoHiddenFieldToAddSGL");

                            listLabelRoomApprovedDBL = (Label)uolistviewHotelInfo.Items[i].FindControl("uoLabelRoomApprovedDBL");
                            listLabelRoomApprovedSGL = (Label)uolistviewHotelInfo.Items[i].FindControl("uoLabelRoomApprovedSGL");

                            //listTextBoxDBL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxToAddDBL");
                            //listTextBoxSGL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxToAddSGL");

                            listTextBoxRoomToDropDBL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRoomToDropDBL");
                            listTextBoxRoomToDropSGL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRoomToDropSGL");

                            //listTextBoxRatePerDayMoneyDBL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRatePerDayMoneyDBL");
                            //listTextBoxRatePerDayMoneySGL = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRatePerDayMoneySGL");

                            //listTextBoxRoomRateTaxPercentage = (TextBox)uolistviewHotelInfo.Items[i].FindControl("uoTextBoxRoomRateTaxPercentage"); ;
                            //listCheckBoxTaxInclusive = (CheckBox)uolistviewHotelInfo.Items[i].FindControl("uoCheckBoxTaxInclusive");

                            //int iToAddDBLOld = GlobalCode.Field2Int(listHiddenFieldToAddDBL.Value);
                            //int iToAddSGLOld = GlobalCode.Field2Int(listHiddenFieldToAddSGL.Value);

                            int iToAddDBLNew = GlobalCode.Field2Int(listLabelRoomApprovedDBL.Text);
                            int iToAddSGLNew = GlobalCode.Field2Int(listLabelRoomApprovedSGL.Text);

                            int iToDropDBL = GlobalCode.Field2Int(listTextBoxRoomToDropDBL.Text);
                            int iToDropSGL = GlobalCode.Field2Int(listTextBoxRoomToDropSGL.Text);

                            //float fRatePerDayMoneyDBL = GlobalCode.Field2Float(listTextBoxRatePerDayMoneyDBL.Text);
                            //float fRatePerDayMoneySGL = GlobalCode.Field2Float(listTextBoxRatePerDayMoneySGL.Text);
                            //int iCurrency = GlobalCode.Field2Int(uoHiddenFieldCurrency.Value);
                            //float fTaxPercent = GlobalCode.Field2Float(listTextBoxRoomRateTaxPercentage.Text);
                            //bool bIsTaxInclusiveSingle = listCheckBoxTaxInclusive.Checked;

                            //if (iToAddDBLOld != iToAddDBLNew ||
                            //    iToAddSGLOld != iToAddSGLNew)
                            //{
                            r = dt.NewRow();
                            r["colBranchIDInt"] = iHotelID;
                            r["colDate"]        = rowDate;
                            r["colToAddDBL"]    = iToAddDBLNew;
                            r["colToAddSGL"]    = iToAddSGLNew;
                            r["colAction"]      = listHiddenFieldAction.Value;

                            r["colRoomToDropDBL"] = iToDropDBL;
                            r["colRoomToDropSGL"] = iToDropSGL;

                            //r["colRatePerDayMoneySGL"] = fRatePerDayMoneySGL;
                            //r["colRatePerDayMoneyDBL"] = fRatePerDayMoneyDBL;
                            //r["colCurrencyIDInt"] = iCurrency;
                            //r["colRoomRateTaxPercentage"] = fTaxPercent;
                            //r["colRoomRateIsTaxInclusive"] = bIsTaxInclusiveSingle;

                            dt.Rows.Add(r);
                            //}
                        }
                    }
                }

                if (dt.Rows.Count > 0)
                {
                    BLL.ApproveForecastManifestByRCCL(GlobalCode.Field2Int(uoDropDownListHotel.SelectedValue),

                                                      uoHiddenFieldUser.Value, "Add Override Forecast by RCCl Approval", "ApproveHotelForecast",
                                                      Path.GetFileName(Request.Path),
                                                      CommonFunctions.GetDateTimeGMT(dateNow), DateTime.Now, dt);

                    GetSFHotelTravelDetails();
                    AlertMessage("Record successfully approved!");
                }
                else
                {
                    AlertMessage("No record changed!");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                if (dt != null)
                {
                    dt.Dispose();
                }
            }
        }
Example #22
0
        public response Update(string fieldValueCollection)
        {
            response r = ValidareColoane(fieldValueCollection);

            if (!r.Status)
            {
                return(r);
            }
            else
            {
                Dictionary <string, string> changes = Newtonsoft.Json.JsonConvert.DeserializeObject <Dictionary <string, string> >(fieldValueCollection, CommonFunctions.JsonDeserializerSettings);
                foreach (string fieldName in changes.Keys)
                {
                    PropertyInfo[] props = this.GetType().GetProperties();
                    foreach (PropertyInfo prop in props)
                    {
                        //var col = CommonFunctions.table_columns(authenticatedUserId, connectionString, "actions");
                        //if (col != null && col.ToUpper().IndexOf(prop.Name.ToUpper()) > -1 && fieldName.ToUpper() == prop.Name.ToUpper()) // ca sa includem in Array-ul de parametri doar coloanele tabelei, nu si campurile externe si/sau alte proprietati
                        if (fieldName.ToUpper() == prop.Name.ToUpper())
                        {
                            var tmpVal = prop.PropertyType.FullName.IndexOf("System.Nullable") > -1 && changes[fieldName] == null ? null : prop.PropertyType.FullName.IndexOf("System.String") > -1 ? changes[fieldName] : prop.PropertyType.FullName.IndexOf("System.DateTime") > -1 ? CommonFunctions.SwitchBackFormatedDate(changes[fieldName]) : ((prop.PropertyType.FullName.IndexOf("Double") > -1) ? CommonFunctions.BackDoubleValue(changes[fieldName]) : Newtonsoft.Json.JsonConvert.DeserializeObject(changes[fieldName], prop.PropertyType));
                            prop.SetValue(this, tmpVal);
                            break;
                        }
                    }
                }
                return(this.Update());
            }
        }
 private void BestelScreen_SizeChanged(object sender, EventArgs e)
 {
     // Set panels to center of the Form
     CommonFunctions.SetPanelDimensions(PMain, ClientSize);
 }
Example #24
0
 public response HasChildren(string tableName, int childrenId)
 {
     return(CommonFunctions.HasChildren(authenticatedUserId, connectionString, this, "plati", tableName, childrenId));
 }
Example #25
0
        private void HomeUserControl_Loaded(object sender, RoutedEventArgs e)
        {
            if (!CommonFunctions.CurrentPrincipal.IsInRole("Administrator"))
            {
                ButtonRestart.IsEnabled = false;
            }

            //if (!CommonFunctions.CurrentPrincipal.IsInRole("Administrator,Editor"))
            //    ButtonInputWizard.IsEnabled = false;

            m_windowsServiceClient = CommonFunctions.GetWindowsServiceClient();

            if (m_windowsServiceClient == null || m_windowsServiceClient.Helper.RemotingClient.CurrentState != ClientState.Connected)
            {
                ButtonRestart.IsEnabled = false;
            }
            else
            {
                m_windowsServiceClient.Helper.ReceivedServiceResponse += Helper_ReceivedServiceResponse;
                CommonFunctions.SendCommandToService("Health -actionable");
                CommonFunctions.SendCommandToService("Version -actionable");
                CommonFunctions.SendCommandToService("Status -actionable");
                CommonFunctions.SendCommandToService("Time -actionable");
                m_eventHandlerRegistered = true;
            }

            m_refreshTimer          = new DispatcherTimer();
            m_refreshTimer.Interval = TimeSpan.FromSeconds(5);
            m_refreshTimer.Tick    += RefreshTimer_Tick;
            m_refreshTimer.Start();

            if (IntPtr.Size == 8)
            {
                TextBlockInstance.Text = "64-bit";
            }
            else
            {
                TextBlockInstance.Text = "32-bit";
            }

            TextBlockLocalTime.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff");

            Version appVersion = AssemblyInfo.EntryAssembly.Version;

            TextBlockManagerVersion.Text = appVersion.Major + "." + appVersion.Minor + "." + appVersion.Build + ".0";

            try
            {
                using (AdoDataConnection database = new AdoDataConnection(CommonFunctions.DefaultSettingsCategory))
                {
                    TextBlockDatabaseType.Text = database.DatabaseType.ToString();

                    try
                    {
                        if (database.IsSqlite || database.IsJetEngine)
                        {
                            // Extract database file name from connection string for file centric databases
                            TextBlockDatabaseName.Text = FilePath.GetFileName(database.Connection.ConnectionString.ParseKeyValuePairs()["Data Source"]);
                        }
                        else if (database.IsOracle)
                        {
                            // Extract user name from connection string for Oracle databases
                            TextBlockDatabaseName.Text = database.Connection.ConnectionString.ParseKeyValuePairs()["User Id"];
                        }
                        else
                        {
                            TextBlockDatabaseName.Text = database.Connection.Database;
                        }
                    }
                    catch
                    {
                        // Fall back on database name if file anything fails
                        TextBlockDatabaseName.Text = database.Connection.Database;
                    }
                }
            }
            catch
            {
                TextBlockDatabaseName.Text = "Not Avaliable";
            }

            try
            {
                using (UserInfo info = new UserInfo(CommonFunctions.CurrentUser))
                {
                    if (info.Exists)
                    {
                        TextBlockUser.Text = info.LoginID;
                    }
                    else
                    {
                        TextBlockUser.Text = CommonFunctions.CurrentUser;
                    }
                }
            }
            catch
            {
                TextBlockUser.Text = CommonFunctions.CurrentUser;
            }

            ((HorizontalAxis)ChartPlotterDynamic.MainHorizontalAxis).LabelProvider.LabelStringFormat = "";

            //Remove legend on the right.
            Panel legendParent = (Panel)ChartPlotterDynamic.Legend.ContentGrid.Parent;

            if (legendParent != null)
            {
                legendParent.Children.Remove(ChartPlotterDynamic.Legend.ContentGrid);
            }

            ChartPlotterDynamic.NewLegendVisible = false;

            m_xAxisDataCollection = new int[m_numberOfPointsToPlot];
            for (int i = 0; i < m_numberOfPointsToPlot; i++)
            {
                m_xAxisDataCollection[i] = i;
            }
            m_xAxisBindingCollection = new EnumerableDataSource <int>(m_xAxisDataCollection);
            m_xAxisBindingCollection.SetXMapping(x => x);

            ComboBoxDevice.ItemsSource = Device.GetLookupList(null);
            if (ComboBoxDevice.Items.Count > 0)
            {
                ComboBoxDevice.SelectedIndex = 0;
            }
        }
Example #26
0
 public response GetChildren(string tableName, int childrenId)
 {
     return(CommonFunctions.GetChildren(this, tableName, childrenId));
 }
Example #27
0
        public void Create(XmlNode charNode, int intValue, int intMinModifier = 0, int intMaxModifier = 0)
        {
            Timekeeper.Start("create_char_attrib");
            foreach (CharacterAttrib objAttribute in AttributeList.Concat(SpecialAttributeList))
            {
                objAttribute.UnbindAttribute();
            }
            AttributeList.Clear();
            SpecialAttributeList.Clear();

            foreach (string strAttribute in AttributeStrings)
            {
                CharacterAttrib objAttribute = new CharacterAttrib(_objCharacter, strAttribute);
                switch (CharacterAttrib.ConvertToAttributeCategory(objAttribute.Abbrev))
                {
                case CharacterAttrib.AttributeCategory.Special:
                    SpecialAttributeList.Add(objAttribute);
                    break;

                case CharacterAttrib.AttributeCategory.Standard:
                    AttributeList.Add(objAttribute);
                    break;
                }
            }

            _objCharacter.BOD.AssignLimits(CommonFunctions.ExpressionToString(charNode["bodmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["bodmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["bodaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.AGI.AssignLimits(CommonFunctions.ExpressionToString(charNode["agimin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["agimax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["agiaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.REA.AssignLimits(CommonFunctions.ExpressionToString(charNode["reamin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["reamax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["reaaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.STR.AssignLimits(CommonFunctions.ExpressionToString(charNode["strmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["strmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["straug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.CHA.AssignLimits(CommonFunctions.ExpressionToString(charNode["chamin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["chamax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["chaaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.INT.AssignLimits(CommonFunctions.ExpressionToString(charNode["intmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["intmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["intaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.LOG.AssignLimits(CommonFunctions.ExpressionToString(charNode["logmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["logmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["logaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.WIL.AssignLimits(CommonFunctions.ExpressionToString(charNode["wilmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["wilmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["wilaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.MAG.AssignLimits(CommonFunctions.ExpressionToString(charNode["magmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["magmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["magaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.RES.AssignLimits(CommonFunctions.ExpressionToString(charNode["resmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["resmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["resaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.EDG.AssignLimits(CommonFunctions.ExpressionToString(charNode["edgmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["edgmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["edgaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.DEP.AssignLimits(CommonFunctions.ExpressionToString(charNode["depmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["depmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["depaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.MAGAdept.AssignLimits(CommonFunctions.ExpressionToString(charNode["magmin"]?.InnerText, intValue, intMinModifier), CommonFunctions.ExpressionToString(charNode["magmax"]?.InnerText, intValue, intMaxModifier), CommonFunctions.ExpressionToString(charNode["magaug"]?.InnerText, intValue, intMaxModifier));
            _objCharacter.ESS.AssignLimits(CommonFunctions.ExpressionToString(charNode["essmin"]?.InnerText, intValue, 0), CommonFunctions.ExpressionToString(charNode["essmax"]?.InnerText, intValue, 0), CommonFunctions.ExpressionToString(charNode["essaug"]?.InnerText, intValue, 0));

            Attributes = new ObservableCollection <CharacterAttrib>
            {
                _objCharacter.BOD,
                _objCharacter.AGI,
                _objCharacter.REA,
                _objCharacter.STR,
                _objCharacter.CHA,
                _objCharacter.INT,
                _objCharacter.LOG,
                _objCharacter.WIL,
                _objCharacter.EDG
            };
            if (_objCharacter.MAGEnabled)
            {
                Attributes.Add(_objCharacter.MAG);
                if (_objCharacter.Options.MysAdeptSecondMAGAttribute && _objCharacter.IsMysticAdept)
                {
                    Attributes.Add(_objCharacter.MAGAdept);
                }
            }
            if (_objCharacter.RESEnabled)
            {
                Attributes.Add(_objCharacter.RES);
            }
            if (_objCharacter.DEPEnabled)
            {
                Attributes.Add(_objCharacter.DEP);
            }
            ResetBindings();
            _objCharacter.RefreshAttributeBindings();
            Timekeeper.Finish("create_char_attrib");
        }
Example #28
0
        public async Task <bool> FilesDownloader(List <string> listOfUrl, string comicName, string chapterNumber, CommonInternalData.DownloadType downloadType, Xamarin.Forms.Button button)
        {
            int fileCount = 0;
            //CommonFunctions commonFunctions = new CommonFunctions();
            string baseDirectoryAddress = await GetDirectory(CommonFunctions.FileNameCleaner(comicName), chapterNumber);

            foreach (string fileUrl in listOfUrl)
            {
                string downloadPercent = DownloadPercentage((double)fileCount, (double)listOfUrl.Count);
                button.Text = downloadPercent + "%";

                if (!string.IsNullOrEmpty(baseDirectoryAddress)) // Make directory and it returns a boolean as a result.
                {
                    string filePath = baseDirectoryAddress + "/" + Convert.ToString(fileCount) + ".jpg";

                    bool isFilePresent = DependencyService.Get <IDirectory>().CheckExisingFile(filePath);
                    if (!isFilePresent) // File is not downloaded yet.
                    {
                        byte[] contents = null;

                        /*
                         * We can set the downloader and revert its contents to this byte[] contents and use it further.
                         */
                        if (downloadType == CommonInternalData.DownloadType.RCO)
                        {
                            contents = await ImageDownloader(baseDirectoryAddress, fileUrl, Convert.ToString(fileCount));
                        }

                        if (contents == null) // If there's nothing, just move onto the next loop.
                        {
                            continue;
                        }

                        bool isFileDownloaded = DependencyService.Get <IDirectory>().CreateFile(filePath, contents);


                        if (!isFileDownloaded)
                        {
                            CommonInternalData.failedDownloadLinks.Add(fileUrl); // If failed, add to failed download list.
                            CurrentData.comic_response = "Download Failed";
                        }
                        else
                        {
                            CurrentData.comic_response     = "Download Completed.";
                            CurrentData.comic_downloadPath = baseDirectoryAddress; // For opening the Explorer.
                        }
                    }
                    else
                    {
                        fileCount++;
                        continue; // File is already downloaded.
                    }
                }
                else
                {
                    return(false);
                }

                fileCount++;
            }

            return(true);
        }
Example #29
0
 public void GetUserTimeTest()
 {
     DateTime dt=   new CommonFunctions().GetServerTime();
      Console.Write(dt.ToString());
 }
 protected void ddlUpazilla_SelectedIndexChanged(object sender, EventArgs e)
 {
     ddlUnion.Items.Clear();
     if (ddlUpazilla.SelectedIndex > 0)
     {
         List <ALRD_UnionInfoEntity> union = ALRD_UnionInfoService.GetService().GetAll(new ALRD_UnionInfoEntity {
             UpazilaID = long.Parse(ddlUpazilla.SelectedValue)
         }).ToList();
         LoadComboRef(ref ddlUnion, union, CommonFunctions.GetPropertyName((ALRD_UnionInfoEntity x) => x.DESCRIPT), CommonFunctions.GetPropertyName((ALRD_UnionInfoEntity x) => x.COMPID));
     }
 }
Example #31
0
    //Biniding content
    protected void BindContents(string search = "")
    {
        importjobManager objimportjob = new importjobManager();
        DataTable        dtcontents   = new DataTable();

        try
        {
            objimportjob.id          = Convert.ToInt32(Request.QueryString["id"]);
            objimportjob.productname = "";

            //objlanguage.languagename = Server.HtmlEncode(txtsearch.Text.Trim());
            if (pageNo == 0)
            {
                pageNo = 1;
            }
            objimportjob.pageNo         = pageNo;
            objimportjob.pageSize       = pageSize;
            objimportjob.SortExpression = SortExpression;
            querystring = "&pageSize=" + ddlpageSize.SelectedValue;

            dtcontents = objimportjob.SearchImportInventoryJobs();
            totalrecs  = objimportjob.TotalRecord;

            if (pageNo == 1)
            {
                objimportjob.pageNo = 1;
                pageNo = 1;
            }
            else if (pageNo == 0)
            {
                objimportjob.pageNo = 1;
                pageNo = 1;
            }
            else
            {
                objimportjob.pageNo = (pageNo - 1) * pageSize;
            }
            objimportjob.pageSize = pageSize;
            totalpages            = totalrecs / pageSize;
            if ((totalrecs % pageSize) > 0 && (totalrecs > pageSize))
            {
                totalpages += 1;
            }
            gvImportjob.DataSource = dtcontents;
            gvImportjob.DataBind();

            if (dtcontents.Rows.Count > 0)
            {
                lblinsertfilecount.Text = "Proccessed " + dtcontents.Rows[0]["Proccessed"] + " rows of which " + dtcontents.Rows[0]["NoErrorLine"] + " passed validation and " + dtcontents.Rows[0]["ErrorLine"] + " failed.";
                int startRowOnPage = (gvImportjob.PageIndex * gvImportjob.PageSize) + 1;
                int lastRowOnPage  = startRowOnPage + gvImportjob.Rows.Count - 1;
                int totalRows      = totalrecs;
                ltrcountrecord.Text = "<div class=\"countdiv\">Showing " + startRowOnPage.ToString() + " to " + lastRowOnPage + " of " + totalRows + " entries</div>";
            }
            String strpaging = CommonFunctions.AdminPaging(totalpages, pageNo, querystring, "ViewImportInventoryJobs.aspx");
            ltrpaggingbottom.Text = strpaging;
            //LoadDropDownList();
        }
        catch (Exception ex)
        {
            //throw ex;
        }
    }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvCustomerLoan_RowEditing(object sender, GridViewEditEventArgs e)
        {
            ObjLoan = new clsLoan();
            dtLoan = new DataTable();
            clsComFun = new CommonFunctions();
            int iLoanId;
            string strValue = string.Empty;
            int intMonth = 0, intYear = 0;
            try
            {
                //BindLoanTypes();
                iLoanId = Convert.ToInt32(((Label)gvCustomerLoan.Rows[e.NewEditIndex].FindControl("lblLoanId")).Text);
                if (iLoanId > 0)
                {
                    ObjLoan.LoanId = iLoanId;
                    dtLoan = ObjLoan.LoanWithSearchFilters();
                    if (dtLoan.Rows.Count > 0)
                    {
                        //Fill Loan Details
                        hdnCustomerId.Value = dtLoan.Rows[0]["CustomerId"].ToString();
                        hdnLoanId.Value = dtLoan.Rows[0]["LoanID"].ToString();

                        //Loan Details
                        txtLoanDate.Text = dtLoan.Rows[0]["LoanDate"].ToString();
                        ddlLoanType.SelectedValue = dtLoan.Rows[0]["LoanTypeID"].ToString();
                        txtLoanAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["LoanAmount"]));
                        txtEmiAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["InstallmentAmount"]));

                        strValue = dtLoan.Rows[0]["LoanPeriod"].ToString();
                        intYear = (System.Convert.ToInt32(strValue) / 12);
                        ddlLoanYear.SelectedValue = intYear.ToString();
                        intMonth = (System.Convert.ToInt32(strValue) - (intYear * 12));
                        ddlLoanMonth.SelectedValue = intMonth.ToString();

                        ddlCustomerPastLoanEMI.SelectedValue = dtLoan.Rows[0]["LoanPaidTypeID"].ToString();
                        txtCustomerLoanPurpose.Text = dtLoan.Rows[0]["LoanReason"].ToString();
                        txtTotalLoanInstallmentAmt.Text = CommonFunctions.FormatMoneyString(Convert.ToDecimal(dtLoan.Rows[0]["TotalInstallment"]));

                        BindCustomerDetails(Convert.ToInt64(dtLoan.Rows[0]["CustomerId"].ToString()));
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID1"]), "1");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID2"]), "2");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID3"]), "3");
                        BindWitnessDetails(Convert.ToInt64(dtLoan.Rows[0]["WitnessID4"]), "4");

                        EnableDisabledControls(false);
                        ShowHideLoanGrid(false);
                        ShowHideLoanWitnessFields(false);
                    }
                }
            }
            catch (Exception) { }
            finally
            {
                ObjLoan = null;
                ObjCust = null;
                dtLoan = null;
            }
            ShowHideLoanGrid(false);
            EnableDisabledControls(false);
        }
Example #33
0
        // Execute authorization query
        private void ExecuteAuthorizationQuery()
        {
            try
            {
                List <Guid> sourceMeasurements;

                lock (m_authorizationQueryLock)
                {
                    sourceMeasurements = m_authorizationQueryIDs.ToList();
                    m_authorizationQueryIDs.Clear();
                }

                List <int>        deviceIDs = new List <int>();
                AdoDataConnection database  = null;

                // Query associated device ID list for given measurements
                try
                {
                    database = new AdoDataConnection(CommonFunctions.DefaultSettingsCategory);
                    string    guidPrefix         = database.DatabaseType == DatabaseType.Access ? "{" : "'";
                    string    guidSuffix         = database.DatabaseType == DatabaseType.Access ? "}" : "'";
                    string    query              = string.Format("SELECT DISTINCT DeviceID FROM ActiveMeasurement WHERE ProtocolType = 'Measurement' AND SignalID IN ({0})", sourceMeasurements.Select(signalID => guidPrefix + signalID.ToString() + guidSuffix).ToDelimitedString(", "));
                    DataTable measurementDevices = database.Connection.RetrieveData(database.AdapterType, query);

                    foreach (DataRow row in measurementDevices.Rows)
                    {
                        int?deviceID = row.ConvertNullableField <int>("DeviceID");

                        if (deviceID.HasValue)
                        {
                            // Validate that device ID is unique (not trusting all databases will handle DISTINCT properly)
                            if (deviceIDs.BinarySearch(deviceID.Value) < 0)
                            {
                                deviceIDs.Add(deviceID.Value);
                                deviceIDs.Sort();
                            }
                        }
                    }
                }
                finally
                {
                    if ((object)database != null)
                    {
                        database.Dispose();
                    }
                }

                // Clear existing destination signal ID lists
                lock (m_authorizedSignalIDs)
                {
                    m_authorizedSignalIDs.Clear();
                }

                // Reset request and response counts to zero
                m_requests  = 0;
                m_responses = 0;

                // Reset state of response complete event (in case a prior event set never completed)
                if ((object)m_responseComplete != null)
                {
                    m_responseComplete.Reset();
                }

                // Send service commands to DataSubscribers to determine signal authorizations
                foreach (int deviceID in deviceIDs)
                {
                    // Send command for authorized signals for this device
                    CommonFunctions.SendCommandToService(string.Format("INVOKE {0} GetAuthorizedSignalIDs", deviceID));
                    m_requests++;
                }

                if (m_requests > 0)
                {
                    // Wait for command responses allowing processing time for each
                    if ((object)m_responseComplete != null)
                    {
                        if (!m_responseComplete.WaitOne(m_requests * m_responseTimeout))
                        {
                            OnProcessException(new TimeoutException(string.Format("Timed-out after {0} seconds waiting for {1} service response{2}.", (m_requests * m_responseTimeout / 1000.0D).ToString("0.00"), m_requests, m_requests == 1 ? "" : "s")));
                        }
                    }

                    // Create a sorted list of the source measurements to use as a filter to authorized measurements
                    List <Guid> sourceFilter = new List <Guid>(sourceMeasurements);
                    sourceFilter.Sort();

                    Guid[] authorizedSignalIDs = null;

                    // Provide user with a distinct list of query results - if there are any
                    lock (m_authorizedSignalIDs)
                    {
                        if (m_authorizedSignalIDs.Count > 0)
                        {
                            authorizedSignalIDs = m_authorizedSignalIDs.Distinct().Where(signalID => sourceFilter.BinarySearch(signalID) >= 0).ToArray();
                        }
                    }

                    if (authorizedSignalIDs != null && authorizedSignalIDs.Length > 0)
                    {
                        OnAuthorizedMeasurements(authorizedSignalIDs);
                    }
                }
            }
            catch (Exception ex)
            {
                OnProcessException(new InvalidOperationException("Authorized measurements query error: " + ex.Message, ex));
            }
        }
Example #34
0
 protected void gvRequisitionInquiry_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     ((BoundField)gvRequisitionInquiry.Columns[6]).DataFormatString = CommonFunctions.GetAppDateFormat();
 }
Example #35
0
        protected void ProcessStep_StartStep(String stepName, String stepDescription, String debug)
        {
            String insertStatement = String.Empty;

            Boolean success;


            Mercury.Server.Data.AuthorityAccountStamp accountInfo = new Mercury.Server.Data.AuthorityAccountStamp(application);

            try {
                base.application.EnvironmentDatabase.BeginTransaction();

                insertStatement = "INSERT INTO logs.MetricProcessStep (ProcessLogId, StepName, StepDescription, StartDate, Debug, ";

                insertStatement = insertStatement + "CreateAuthorityName, CreateAccountId, CreateAccountName, CreateDate, ";

                insertStatement = insertStatement + "ModifiedAuthorityName, ModifiedAccountId, ModifiedAccountName, ModifiedDate) ";

                insertStatement = insertStatement + "VALUES (";

                insertStatement = insertStatement + processLogId.ToString() + ", '" + CommonFunctions.SetValueMaxLength(stepName, 60) + "', '" + CommonFunctions.SetValueMaxLength(stepDescription, 120) + "', '" + DateTime.Now.ToString() + "', ";

                insertStatement = insertStatement + "'" + CommonFunctions.SetValueMaxLength(debug.Replace("'", "''"), 3000) + "', ";

                insertStatement = insertStatement + "'" + accountInfo.SecurityAuthorityNameSql + "', '" + accountInfo.UserAccountIdSql + "', '" + accountInfo.UserAccountNameSql + "', '" + DateTime.Now.ToString() + "', ";

                insertStatement = insertStatement + "'" + accountInfo.SecurityAuthorityNameSql + "', '" + accountInfo.UserAccountIdSql + "', '" + accountInfo.UserAccountNameSql + "', '" + DateTime.Now.ToString() + "'";

                insertStatement = insertStatement + ")";


                success = base.application.EnvironmentDatabase.ExecuteSqlStatement(insertStatement.ToString(), 0);

                if (!success)
                {
                    throw base.application.EnvironmentDatabase.LastException;
                }


                processStepId = 0;

                if (processStepId == 0)   // RESET DOCUMENT ID CRITERIA

                {
                    Object identity = base.application.EnvironmentDatabase.ExecuteScalar("SELECT @@IDENTITY").ToString();

                    if (!Int64.TryParse((String)identity, out processStepId))
                    {
                        throw new ApplicationException("Unable to retreive unique id.");
                    }
                }

                base.application.EnvironmentDatabase.CommitTransaction();
            }

            catch (Exception logException) {
                System.Diagnostics.Trace.WriteLine(insertStatement);

                System.Diagnostics.Trace.WriteLine(logException);

                System.Diagnostics.Trace.Flush();

                base.application.EnvironmentDatabase.RollbackTransaction();
            }

            return;
        }
Example #36
0
    private void BindGrid()
    {
        dtRequisitionItemsTableAdapter RequisitionItemsAdapter = new dtRequisitionItemsTableAdapter();

        gvRequisitionInquiry.DataSource = RequisitionItemsAdapter.GetDataByRequestInquiryParams(ddlToLocation.SelectedItem.Text.Trim(), ddlFromLocation.SelectedItem.Text, CommonFunctions.ConvertToUniversalDate(txtRequiredDateFrom.Text), CommonFunctions.ConvertToUniversalDate(txtRequiredDateTo.Text), ddlToWarehouse.SelectedItem.Text, ddlFromWarehouse.SelectedItem.Text);
        gvRequisitionInquiry.DataBind();
    }
Example #37
0
 private void lblName_Click(object sender, EventArgs e)
 {
     CommonFunctions objCommon = new CommonFunctions(_skill.CharacterObject);
     objCommon.OpenPDF(_skill.Source+" "+_skill.Page);
 }